atk4 / ui

Robust and easy to use PHP Framework for Web Apps
https://atk4-ui.readthedocs.io
MIT License
440 stars 105 forks source link

Opened Tab/Accordion should have public URL #2070

Open mkrecek234 opened 1 year ago

mkrecek234 commented 1 year ago

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


Situation:

How to implement:

mkrecek234 commented 1 year ago

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

Expected behaviour according to this feature request:

Current behavior:

mvorisek commented 1 year ago

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 https://github.com/atk4/ui/commit/a6400097792399feadce3358658670d8bf7bc341. 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.

mkrecek234 commented 1 year ago

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

mvorisek commented 1 year ago

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 commented 1 year ago

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

mkrecek234 commented 1 year ago

@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 commented 1 year ago

yes, it is in the edited description already :)

mvorisek commented 12 months ago

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 commented 12 months ago

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 commented 11 months ago

For single tab/traverse path - related issues: https://github.com/atk4/ui/issues/451 and https://github.com/atk4/mastercrud/issues/25