Page MenuHomePhabricator

[Table of contents] Increase max-height of TOC
Closed, ResolvedPublic3 Estimated Story Points

Description

Description

Currently there is a max-height on the table of contents (.sidebar-toc { max-height: 75vh; }). The purpose of having a max-height is to prevent the table of from extending off the bottom of the screen, (because then it would be impossible to scroll all the way to the bottom of the TOC). The choice of having the max-height be 75vh was to make it easier to scroll all the way to the bottom of the TOC when you are at the top of the page (because there is a ~160px of space between the top of the screen and the top of the TOC initially, so if the max-height was 100vh-the sticky offset of the TOC, you wouldn't be able to reach the bottom of the TOC without scrolling the page first, and getting the TOC into it's sticky position). Here is what we have currently, which allows you to scroll to the bottom of the TOC without scrolling the page:

image.png (1×1 px, 403 KB)

However, due to the logic we added in T300973, the table of contents is rarely so tall that you would encounter this situation (this happens more on admin pages like wp:ANI). Also, if you scroll the TOC container, and then can't get to the bottom, if you keep trying to scroll without even moving your cursor it will scroll the page. Here is a video of that happening, with the max-height of the TOC set to calc (98vh - 1.5em) (1.5 is the topposition of the TOC when it is sticky):

You can see how the scrolling stops before reaching the bottom of the TOC, and then the secondary scroll scrolls the entire page, allowing you to get to the bottom of the TOC.

To do

Increase the max-height of the TOC to 98vh minus whatever the top offset is (I think it might be different if you are logged-in, with the sticky header, versus logged-out).

QA steps

Perform the following steps when logged-out and logged-in

  1. Visit https://en.wikipedia.beta.wmflabs.org/wiki/Cat
  2. Scroll down so that the table of contents is sticky
  3. Expand every section of the table of contents so that it has a scrollbar
  4. Verify that the table of contents height spans most of the viewport's height. You should still be able to see all of the contents of the TOC by scrolling it. Ensure the scroll indicator at the bottom is also visible when not scrolled to the bottom of the TOC.

QA Results - Beta

ACStatusDetails
1T319315#8616882

QA Results - Prod

ACStatusDetails
1T319315#8620527

Event Timeline

LGoto set the point value for this task to 3.Jan 26 2023, 6:22 PM

I see this as important to fixing some of the complaints about the ToC that we have seen. There is some visual disjunction now on long ToCs that I think is turning people away from it.

  1. Setting .vector-toc to something like calc(100vh - 3.125em) seems like a good approach to improve this.
  2. I also think that padding-top of 1.5 em on the .vector-pinned-container, should be moved to a margin-top on the <nav.mw-table-of-contents-container> (it should be outside of the pin, as the spacing is in relation to the surrounding content and not the sticky content)
  3. We can also look into some styling for the scrollbar. I noticed that Citizen skin has prettified this quite a bit and it really feels much more refined. This is supported on Chrome/Edge and Safari, and Firefox supports the IE properties

I'm currently testing these overrides in my personal CSS:

.vector-feature-page-tools-enabled .vector-toc-pinned #mw-panel-toc,
.vector-feature-page-tools-enabled.vector-toc-pinned #mw-panel-toc,
.vector-feature-page-tools-disabled .vector-toc-pinned #mw-panel-toc {
	margin-top: 1.5rem;
}
.vector-toc-pinned #vector-toc-pinned-container {
	padding-top: 0;
}
.vector-toc {
	max-height: calc(100vh - 3.125rem);
}

This gets the top offset wrong when the menu is hidden, but I'm sure that can easily be fixed later

Change 886437 had a related patch set uploaded (by Nray; author: Nray):

[mediawiki/skins/Vector@master] Make page tools sticky

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

Mabualruz moved this task from Code Review to QA on the Web-Team FY2022-23 Q3 Sprint 2 board.
Mabualruz subscribed.

Change 886437 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Make page tools sticky

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

nray updated the task description. (Show Details)
nray subscribed.

Change 888100 had a related patch set uploaded (by Nray; author: Nray):

[mediawiki/skins/Vector@master] Make anon sticky toc offset the same as logged-in offset

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

nray moved this task from QA to Code Review on the Web-Team FY2022-23 Q3 Sprint 2 board.

@alexhollender_WMF could you please review the patchdemo and then move back to code review or needs more work?

Test wiki created on Patch demo by Jdlrobson using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/219cc10c25/w

Change 888109 had a related patch set uploaded (by Nray; author: Nray):

[mediawiki/skins/Vector@master] Increase space between top of TOC/Page tools and top of viewport

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

Test wiki created on Patch demo by NRay (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/ff11c52245/w

Change 888100 abandoned by Nray:

[mediawiki/skins/Vector@master] Make anon sticky toc offset the same as logged-in offset

Reason:

See https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/888109

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

nray moved this task from Code Review to QA on the Web-Team FY2022-23 Q3 Sprint 2 board.

Waiting for this to land on beta and then will hand over to @Edtadros

Change 888109 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Make space between top of TOC/Page tools and top of viewport/bottom of sticky header 30px

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

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Ventura
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps
  1. Visit https://en.wikipedia.beta.wmflabs.org/wiki/Cat
  2. Scroll down so that the table of contents is sticky
  3. Expand every section of the table of contents so that it has a scrollbar
  4. ✅ AC1: Verify that the table of contents height spans most of the viewport's height. You should still be able to see all of the contents of the TOC by scrolling it. Ensure the scroll indicator at the bottom is also visible when not scrolled to the bottom of the TOC.

@ovasileva, this passes, based on the specs above. There is one peculiar behavior outside of the scope in the QA steps. When logged in the TOC when sticky sits a bit lower on the page. I'm not sure why this is or if it is expected.

Logged OutLogged In
Screen Recording 2023-02-14 at 3.48.37 PM.mov.gif (504×1 px, 1 MB)
Screen Recording 2023-02-14 at 3.45.42 PM.mov.gif (504×1 px, 1 MB)

//@ovasileva, this passes, based on the specs above. There is one peculiar behavior outside of the scope in the QA steps. When logged in the TOC when sticky sits a bit lower on the page. I'm not sure why this is or

@Edtadros can you try logging in with another user until you see the sticky header? For some reason, we still have the sticky header AB test enabled on beta so you're seeing a gap that the sticky header usually fills.

This is also related to a separate issue, T329397, where there is too much space between the top of the TOC and page tools and the top of the viewport for certain logged-in pages where we don't show the sticky header like the diff page, preferences page, etc, but that shouldn't affect article pages unless that AB test is running.

Test Result - Prod

Status: ✅ PASS
Environment: cawiki
OS: macOS Ventura
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps
  1. Visit https://en.wikipedia.beta.wmflabs.org/wiki/Cat
  2. Scroll down so that the table of contents is sticky
  3. Expand every section of the table of contents so that it has a scrollbar
  4. ✅ AC1: Verify that the table of contents height spans most of the viewport's height. You should still be able to see all of the contents of the TOC by scrolling it. Ensure the scroll indicator at the bottom is also visible when not scrolled to the bottom of the TOC.
Logged OutLogged In
Screen Recording 2023-02-15 at 4.48.26 PM.mov.gif (610×1 px, 1 MB)
Screen Recording 2023-02-15 at 4.47.17 PM.mov.gif (610×1 px, 2 MB)

Test wiki on Patch demo by Jdlrobson using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/219cc10c25/w/

Test wiki on Patch demo by NRay (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/ff11c52245/w/