? ? Pending
Referenced as Related to: # 15214

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
12 Jan 2017

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 ?

Summary of Changes

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.

Testing Instructions

  • 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.

If you want you can also inspect the data in the browser tools.

Documentation Changes Required

None

avatar Bakual Bakual - open - 12 Jan 2017
avatar Bakual Bakual - change - 12 Jan 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Jan 2017
Category JavaScript
avatar Bakual
Bakual - comment - 12 Jan 2017

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.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 15 Jan 2017

I have tested this item ? unsuccessfully on 53ee212

Tested on article works like testing instructions said, with module in new browser-tab also last used tab is shown.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13572.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 15 Jan 2017 - Tested unsuccessfully
avatar Bakual
Bakual - comment - 15 Jan 2017

@franz-wohlkoenig Did you really mean to add an unsuccessful test?

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 15 Jan 2017

@Bakual Yes, because for Module in new browser-tab not the first tab is shown, the last used tab is shown (ie. the 2nd). In Article it works as written in instructions (in new browser-tab the first tab is shown).

avatar dgt41
dgt41 - comment - 15 Jan 2017

@franz-wohlkoenig what was the browser?

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 15 Jan 2017

@dgt41: Firefox 50.1.0 (Joomla! 3.7.0-alpha2-nightly, macOS Sierra, 10.12.2, PHP 7.0.4, MySQLi 5.5.53-0)

avatar Bakual
Bakual - comment - 15 Jan 2017

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.

avatar Bakual Bakual - change - 27 Jan 2017
Labels Added: ?
avatar csthomas
csthomas - comment - 27 Jan 2017

I have tested this item successfully on 25f7685

Tested on articles and modules. FF cache OFF.
Settings is preserved per tab. Reset by new/close browser tab.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13572.

avatar csthomas csthomas - test_item - 27 Jan 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 2 Feb 2017
  1. Edit an article (or module, plugin, whatever) and change the tab.
  2. Click "Save" (not "Save & Close"), the form should reload with the same tab active.
  3. Click "Save & Close" and then re-edit the item. The form should open with the same tab active again.
  4. 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.

Test on:

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

avatar Bakual
Bakual - comment - 2 Feb 2017

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.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 2 Feb 2017

@csthomas got successfully test on Firefox, maybe other Version and/or different OS.

avatar csthomas
csthomas - comment - 2 Feb 2017

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.

avatar tonypartridge
tonypartridge - comment - 2 Mar 2017

@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?

avatar Bakual
Bakual - comment - 2 Mar 2017

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 ?

avatar tonypartridge
tonypartridge - comment - 2 Mar 2017

@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.

avatar Bakual
Bakual - comment - 2 Mar 2017

It was added so when you use the "Save" and not "Save & Close" button (or reload the page) you stay on the same tab and don't jump back to the first tab. Which imho makes sense in that specific case.
PR which introduced it: #1458.

avatar tonypartridge
tonypartridge - comment - 2 Mar 2017

@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.

avatar Bakual
Bakual - comment - 2 Mar 2017

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).

avatar tonypartridge tonypartridge - test_item - 2 Mar 2017 - Tested successfully
avatar tonypartridge
tonypartridge - comment - 2 Mar 2017

I have tested this item successfully on 25f7685

Resolves the issue @Bakual describes. Tested on Chrome and then Safari.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13572.

avatar dgt41 dgt41 - test_item - 2 Mar 2017 - Tested successfully
avatar dgt41
dgt41 - comment - 2 Mar 2017

I have tested this item successfully on 25f7685


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13572.

avatar dgt41 dgt41 - change - 2 Mar 2017
Status Pending Ready to Commit
avatar dgt41
dgt41 - comment - 2 Mar 2017

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13572.

avatar zero-24 zero-24 - change - 3 Mar 2017
Milestone Added:
Labels Added: ?
avatar rdeutz rdeutz - change - 3 Mar 2017
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
avatar rdeutz rdeutz - close - 3 Mar 2017
avatar rdeutz rdeutz - merge - 3 Mar 2017

Add a Comment

Login with GitHub to post a comment