Page MenuHomePhabricator

Scroll position is always preserved when switching tab in an dialog using IndexLayout
Closed, ResolvedPublic

Description

Steps to replicate:

  1. On Mobile VE, open the Graph dialog/Media dialog
  2. Scroll down.
  3. Switch tab or just close this dialog.
  4. Reopen this tab again.

The scrollbar inside the dialog is still in the previous position.

Event Timeline

Ryasmeen created this task.Oct 2 2018, 2:26 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 2 2018, 2:26 AM
Esanders renamed this task from On Mobile VE, for Graph and Media dialog, the scrollbar position does not reset to the top while switching tabs or even after re-opening the dialog to Scroll position is always preserved when switching tab in an IndexLayout.Oct 2 2018, 12:09 PM
Esanders added a project: OOUI.

This happens on desktop too, but as we usually have autofocus enabled (which is disabled on mobile to avoid the virtual keyboard), the page usually scrolls back to somewhere near the top.

The question is then do we:

  • Always/optionally reset scrolling when switching between tabs (this may be undesirable)
  • Provide a "reset scrolling" method that has to be called each time the dialog is opened.

CC @matmarex @Volker_E

Esanders moved this task from To Triage to Q4 on the VisualEditor board.Oct 3 2018, 2:45 PM
JTannerWMF moved this task from Q4 to Current work on the VisualEditor board.Oct 3 2018, 5:00 PM
JTannerWMF edited projects, added VisualEditor (Current work); removed VisualEditor.
Esanders claimed this task.Oct 4 2018, 12:10 PM
Esanders moved this task from Incoming to In progress on the VisualEditor (Current work) board.
Esanders renamed this task from Scroll position is always preserved when switching tab in an IndexLayout to Scroll position is always preserved when switching tab in an dialog using IndexLayout.Oct 4 2018, 12:22 PM

What use case comes to our minds where switching tabs should not result in a start from TabPanel top and would be expected?

Say there is a tab panel with a particular long page where I have scrolled to a specific location. I then need to look something up on another tab before returning to the long tab in the same place. This is the same behaviour as browser tabs. I feel resetting scroll every time you change tabs would be unexpected.

Change 464641 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Reset scroll and tab state in media dialogs

https://gerrit.wikimedia.org/r/464641

Interesting, this is actually a browser feature and not something we implement in OOUI. The scroll position of hidden elements is restored when they are shown again. Try scrolling and using the "Swap panels" button. http://jsfiddle.net/dwLk74y1/3/

Even more interesting, it seems that setting the scroll position while the element is hidden is impossible. The previous scroll position is still restored when they are shown. Try using the "Scroll to middle" button and note that the hidden panel is not scrolled.

Change 464641 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Reset scroll and tab state when closing dialogs

https://gerrit.wikimedia.org/r/464641

Not seeing the fix on Beta cluster yet. Moving it to stalled until it's ready to test.

Looks like this was not implemented for the graph dialog yet, sorry.

Change 472244 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/Graph@master] Reset scroll when closing dialog

https://gerrit.wikimedia.org/r/472244

Change 472244 merged by jenkins-bot:
[mediawiki/extensions/Graph@master] Reset scroll when closing dialog

https://gerrit.wikimedia.org/r/472244

marcella closed this task as Resolved.Nov 19 2018, 4:38 PM
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptNov 19 2018, 4:38 PM