Page MenuHomePhabricator

Horizontal shift when scrollbar appears as you transition between states in Minerva and Vector
Closed, ResolvedPublic

Description

There's a small redraw (on Chrome/MacOS) resulting in a horizontal shift when scrollbars kick in on Vector.
First reported in T195986#4572417 by @Ryasmeen.

Screen capture:

A similar issue impacts Minerva on tablets and desktop when you click a reference and the transition animation (pay attention to the scroll bar on right):

Screenshot 2019-08-01 at 3.51.51 PM.png (544×519 px, 134 KB)

Screenshot 2019-08-01 at 3.51.55 PM.png (786×524 px, 187 KB)

Developer notes

Add overflow: scroll to the body tag so the scrollbar is always present.

Event Timeline

Screenshots from the recording:

1.png (756×1 px, 166 KB)
3.png (756×1 px, 173 KB)

The first column is using 20% width, so its computed width changes when the scrollbar appears and the page's width changes. I suppose you could set its size in ems instead to avoid this if it's annoying/noticeable. (I'll note that the same behavior is noticeable on the non-OOUI preferences page.)

Jdlrobson renamed this task from Horizontal shift when scrollbar appears on page load to Horizontal shift when scrollbar appears as you transition between states in Minerva and Vector.Aug 1 2019, 10:53 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson subscribed.

This impacts a lot of websites
The fix is simply adding overflow: scroll; to the body tag so it's always present.
Also happens on references when you click one on Minerva so should probably apply to both.

Change 551672 had a related patch set uploaded (by VolkerE; owner: VolkerE):
[mediawiki/skins/Vector@master] Set overflow-y to scroll to prevent reflow

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

Change 551678 had a related patch set uploaded (by VolkerE; owner: VolkerE):
[mediawiki/skins/MinervaNeue@master] Set overflow-y to scroll to avoid reflow

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

Change 551672 merged by jenkins-bot:
[mediawiki/skins/Vector@master] Set overflow-y to scroll to prevent reflow

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

Change 551678 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Set overflow-y to scroll to avoid reflow

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

You will have to carefully test that this doesn't break any modal dialogs / drawers / etc. that are supposed to prevent the scrolling of the page.

OOUI is probably compatible, as long as you apply overflow-y: scroll on body (after we experimented with it in 2aa75094e3e8c5cf6b9a7ece32436fabe46baf14 / 4a167fb00d259e596545f9d057acf92fa1aabbde), but you should also test OOUI dialogs in both of the skins just in case.


I have to say that I'm not sure how I feel about this solution overall. It will look a bit silly on short pages that wouldn't otherwise have a scrollbar (e.g. https://en.wikipedia.org/wiki/Eemeli_Aakula).

This change has added visible scrollbar to all pages on Vector, regardless of page needing scrollbar or not. What @matmarex wrote above.

I have found one example from howiki, that is already on 1.35.0-wmf.8 in production, and with small enough content and Vector sidebar, to show this:

howiki scrollbar.png (938×842 px, 235 KB)

Jdlrobson claimed this task.

I think this is the right behaviour. I'm not seeing any obvious bugs a month later - please open specific ones if they exist.

Change 604786 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/skins/Vector@master] Revert "Set overflow-y to scroll to prevent reflow"

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

Change 604787 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/skins/MinervaNeue@master] Revert "Set overflow-y to scroll to avoid reflow"

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

These patches shouldn't be reverted. We should not re-introduce Minerva/Vector bugs (specifically ones resolved a long time ago) to fix OOUI bugs. Happy to help with the OOUI bug, and happy to live with a short term fix of a similar nature provided its in the OOUI library.

Change 605190 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/core@master] Add temporary workaround for scrollIntoView bug when OOUI is loaded

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

Change 604786 abandoned by Esanders:
Revert "Set overflow-y to scroll to prevent reflow"

Reason:
See I34c05c512d731eb5977c51f503f7f29ebcdfbdbf

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

Change 604787 abandoned by Esanders:
Revert "Set overflow-y to scroll to avoid reflow"

Reason:
See I34c05c512d731eb5977c51f503f7f29ebcdfbdbf

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

In my experience the page layout jumping when a scrollbar is shown is a more disturbing experience than having a disabled scrollbar on short pages, therefore I support @Jdlrobson's preference. It seems to me this is the better trade-off.

If someone wants to put effort into hiding the scrollbar on short pages, this can be done with JS, however the horizontal scrollbar and browser differences (most notably Mac) will make this a non-trivial task that requires some research and testing to get it right.

Alternatively, the sidebar can be styled, making it less noticeable when disabled. This can be done with a few lines of Less (sample) using the mixins I've made: patch 579620
These handle FF, WebKit and IE scrollbar styling.

Change 605190 abandoned by Esanders:
Add temporary workaround for scrollIntoView bug when OOUI is loaded

Reason:
Ib6bda230f3ab4f0a12454cc7eafc220ce5f7f700 has been merged into OOUI

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