User tests: Successful: Unsuccessful:
This PR is a different approach from #13105
Currently, the last active tab of any edited item is stored forever locally in your browser. This can cause some unexpected behavior of edit forms. Eg you edit an article and had the permission tab open when you saved the article. Now you go on with your regular business and when you're going to edit an article again on that site (may be the same day or another month), it will open with the permission tab active again. That comes quite unexpected because you certainly have forgotten by now that you had the permission tab open last time
Changes the storage place for the tabstate data from localStorage to sessionStorage which means it is specific to the active tab and gets deleted when the tab is closed.
That should greatly reduce the confusing behavior of tab states we currently have.
If you want you can also inspect the data in the browser tools.
None
Status | New | ⇒ | Pending |
Category | ⇒ | JavaScript |
I have tested this item
Tested on article works like testing instructions said, with module in new browser-tab also last used tab is shown.
@franz-wohlkoenig Did you really mean to add an unsuccessful test?
@franz-wohlkoenig what was the browser?
Hmm, may it be that the browser had an already cached version of the JavaScript code and thus did it the old way? I don't see a reason why modules would behave different than articles otherwise.
I just tried with Firefox and it also behaves as expected.
Labels |
Added:
?
|
I have tested this item
Tested on articles and modules. FF cache OFF.
Settings is preserved per tab. Reset by new/close browser tab.
- Edit an article (or module, plugin, whatever) and change the tab.
- Click "Save" (not "Save & Close"), the form should reload with the same tab active.
- Click "Save & Close" and then re-edit the item. The form should open with the same tab active again.
- Edit an article in another browser tab. The first tab should be active.
Tested again: 1-3 works. 4: Other Article in new Browsertab shows same active Tab as in 3.
Joomla! 3.7.0-staging
macOS Sierra, 10.12.3
Firefox 50.1.0 (private Modus)
PHP 7.0.4
MySQLi 5.5.53-0
4: Other Article in new Browsertab shows same active Tab as in 3.
According to caniuse.com
In private browsing mode, Safari, iOS Safari and the Android browser (not include Chrome for Android) do not support setting sessionStorage or localStorage.
This may play a role here. Different browsers may also have a different behavior for new tabs - I don't know that personally.
I have FF 51.0.1 on linux (private mode also tested and OK).
I did, edit article, change tab in article, close article, edit article again, close article, edit article in next browser tab (and get first active article tab).
I got your result if I do not applied current PR.
@Bakual I have tested this and yes it works from a new browser view.
But Save and new opens the same tab again and again, it's stuck on the current browser/session.
Shouldn't we be storing the id, component and type i.e. edit or new ?Then we can decide with JS to pre-select the tab or not?
Shouldn't we be storing the id, component and type i.e. edit or new ?Then we can decide with JS to pre-select the tab or not?
Component and view are stored currently (most of the URL actually), but the ID may be useful as well. However as long as it is stored in localStorage I wouldn't add the ID as that would blow up that list a lot more. It's already ridiculous long as it is. When we switch to sessionStorage, we can add the ID fine if still needed.
But you don't want me to mess with JS to add that. It would be something for another PR from another contributor
@Bakual what I am struggling to understand is why we are making tabs so complicated? Why are we storing the tab selection at all? Is it for the few people who edit and save so the tab they saved on is loaded? If that's the only case, in my eyes this is causing more of an issue that it was without it.
@Bakual And for that specific case it does make sense I agree, but in doing so it applies to save, save & close and all other menu items. And it only seems to be affecting browsers recently.
To me, if would make more sense to do this on the php level i.e. save and close includes a post variable on save / apply which has the last tab selected. Then when the user goes to the list view and create a new article for instance it's not remembering the selected tab from the session.
Honestly I don't care. I just want to fix the use of localStorage because it is very disturbing to have an article open on the permission tab just because you closed it with that tab open the last time you edited an article (which may be a half year ago).
I have tested this item
Resolves the issue @Bakual describes. Tested on Chrome and then Safari.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Milestone |
Added: |
||
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-03-03 15:05:40 |
Closed_By | ⇒ | rdeutz | |
Labels |
On a sidenote: This doesn't solve the issue that the tab is stored across all items of the same type (eg all modules, or all articles) which can cause some issues as well.
For that we would need to take into account the ID of the item as well.