silverstripe / silverstripe-admin

Silverstripe Admin Component
BSD 3-Clause "New" or "Revised" License
25 stars 91 forks source link

Jumping to random CMS tabs when navigating pages #1684

Open satrun77 opened 4 months ago

satrun77 commented 4 months ago

Module version(s) affected

5.1, but basically every version ever made.

Description

The CMS tries to remember what tab you were looking at when you save your page.

This is there so the content author stays on the same tab when the response comes back from the server. However, it remember your tab for the rest of your session. So you keep going back to that tab by default all the time.

Related issue https://github.com/silverstripe/silverstripe-cms/issues/2924

How to reproduce

Possible Solution

Find the bit that reload the tab you were looking at on step 4, and unset the session storage flag after you read it.

Additional Context

The currently displayed tab is recorded in the session storage on save.

Validations

PRs

See https://github.com/silverstripe/silverstripe-admin/issues/1684#issuecomment-1960364607 about changes that are still required

GuySartorelli commented 4 months ago

The linked PR is merged and it will be automatically tagged by GitHub actions, and within a week or so it'll be merged up to and tagged in CMS 5. Let me know if you need that sooner @satrun77

I'm going to leave this open though because there's still a scenario in which it's not fixed. In the PR description:

The fix is to remove the tab state after navigating away from the page. Note that the state is not removed if the URL from the address bar is changed manually.

And in https://github.com/silverstripe/silverstripe-admin/pull/1683#issuecomment-1958564519:

For the situation when the URL is changed manually, could we add a TTL to the saved value and if it's expired, reset the saved tab to the default? Could be quite short lived I'd say.

Alternatively, could it be safe to assume there should only be one tab stored for the current session, so any other URL can remove the saved state for other pages? Do we need to index the storage by the URL at all?

satrun77 commented 4 months ago

@GuySartorelli It is all good we can use fork for now until new release for CMS 5