Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opened Tab/Accordion should have public URL #2070

Open
mkrecek234 opened this issue Jun 9, 2023 · 10 comments
Open

Opened Tab/Accordion should have public URL #2070

mkrecek234 opened this issue Jun 9, 2023 · 10 comments

Comments

@mkrecek234
Copy link
Contributor

mkrecek234 commented Jun 9, 2023

Any directly reachable tab/accordion (ie. content without internal state/POST data like temporary modal) have VP/Callback link and:

  • such link should be set as the current URL when clicked
  • the link should be possible to be opened by using the link solely (of course with auth etc.)
  • any menu items should use a tag with possibility to be opened like regular <a href="..., ie. with left/middle button, with context menu "Open in a New Tab/Window"...

Situation:

  • You have a view which has tabs, and/or cruds and/or accordions.
  • Sometimes it is helpful to send a URL of the exact screen the user is in to someone else. As the screen is the view script, but might also currently have an opened modal, or a selected tab or an opened accordion, it would be helpful that the URL reflects the current state of the view., conceptually:
  • localhost/view.php?viewcrud1={useraction=edit, id=12345} for indicating that the user currently has opened an edit modal inside viewcrud1
  • Sending then that URL will make sure, that on any browser the view is displayed in the same state as one sees it.

How to implement:

  • the browsers URL-line dynamically will be adjusted via jQuery/DOM whenever a tab is selected, or a modal is opened or an accordion is opened; this makes sure that URL always reflects the right state as parameters to the current script.
  • When rendering such a URL, the views like tab, grid/crud, accordion will respect the currently active configuration that is found in the URL.
@mkrecek234
Copy link
Contributor Author

@mvorisek No, this is not completed. For example:

  • Open and view with a crud, then select any line and open the edit modal.
  • Then copy the URL in the browser window and open it in a new browser window.

Expected behaviour according to this feature request:

  • The page is opened and it shows exactly the same view, including the opened edit modal

Current behavior:

  • It opens the view without an opened modal.

@mvorisek
Copy link
Member

mvorisek commented Jun 9, 2023

If all params are passed by GET, the problem should be solved with/in #2068. Usecase with Modal, will require sending POST params in URL (as GET), do we wan to support that?

Last week I fixed a640009. It took me over a day to understand the problem... and I finally understand what we exactly do in atk4/ui multi step modal executor, we use local storage on the client... So again, this will need to be encoded in the URL. I am for removing the local storage, but I belive we should solve it gradually and with a budget we can reason by a better productivity, less maintanence, less end user errors, ... As you do not want to sponsor this issue completely right now, I close it again to keep the focus on important tasks.

@mvorisek mvorisek closed this as completed Jun 9, 2023
@mkrecek234 mkrecek234 changed the title Dynamic URL when opened modal or tab Idea: Dynamic URL when opened modal or tab Jun 9, 2023
@mkrecek234 mkrecek234 reopened this Jun 9, 2023
@mkrecek234
Copy link
Contributor Author

@mvorisek Can we please keep idea "issues" open - this should be a storage for ideas, even if they are not currently implemented.

@mvorisek
Copy link
Member

mvorisek commented Jun 9, 2023

If you want to implement this or contribute to this topic in any way, feel free to reopen it, but too broad ideas are not much helpful if only opened.

@mvorisek mvorisek closed this as completed Jun 9, 2023
@mvorisek mvorisek changed the title Idea: Dynamic URL when opened modal or tab Opened Tab/Accordion should have public URL Jun 11, 2023
@mvorisek
Copy link
Member

Michael, I narrowed your idea to something wanted and feasible and reopened it. Thank you.

@mkrecek234
Copy link
Contributor Author

mkrecek234 commented Jun 11, 2023

@mvorisek Thank you - I would like to make the idea more concrete that not only the tab has a public URL (on right-click) but also that the browser window‘s URL is adjusted on tab change, so whenever a user copies the current URL and forwards it, the recipient opens the same view state. This can be done with:

const url = new URL(window.location.href); url.searchParams.set('param1', 'val1'); url.searchParams.delete('param2'); window.history.replaceState(null, null, url); // or pushState

@mvorisek
Copy link
Member

yes, it is in the edited description already :)

@mvorisek
Copy link
Member

mvorisek commented Oct 9, 2023

This feature request is very tricky, as page can contains more than one tabs groups/accordions and can be nested - the URL will have to contain state for all of them.

@mkrecek234
Copy link
Contributor Author

Yes, correct, but in a lot of UIs for usability reasons you would not nest too many tabs or accordions. Also a simple solution would be to make the accordion or tab group configurable if it should update the URL and add its state to it or not. In this case the developer could set which accirdion or tab can be pre-set by a URL parameter.

@mvorisek
Copy link
Member

For single tab/traverse path - related issues: #451 and atk4/mastercrud#25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants