Page MenuHomePhabricator

[Visual refinements] Change width of TOC (menu version)
Closed, ResolvedPublic2 Estimated Story Points

Description

Description

If the TOC has been collapsed/hidden it can be opened in a menu. Currently the max-width on this TOC menu is 244px. We would like to remove that max-width and instead add a max-width that is a percentage of the article width: 95%.

Why add a max-width at all?
The width of the article provides a sort of implicit max-width. For example:

Screen Shot 2022-08-23 at 5.27.22 PM.png (753×1 px, 100 KB)

However allowing the TOC menu to be as wide as the article becomes an issue for:

narrow screenslogged-in people w/ sticky header
because there is not much room outside of the TOC to click in order to close itbecause it goes off the edge of the screen
Screen Shot 2022-08-23 at 5.29.27 PM.png (738×832 px, 83 KB)
Screen Shot 2022-08-23 at 5.29.50 PM.png (765×1 px, 150 KB)

AC

  • The collapsed TOC menu no longer has a 220px fixed width
  • The TOC menu has a max-width equaling 85% of the main content text (51em) when collapsed into the page title.
  • The TOC menu has the same behavior when collapsed into other locations (i.e. the sticky header, floating on narrow screens)
  • On narrow screens the TOC menu still never covers the text completely (uses 75vw)
  • The TOC menu has a min width of 200px
  • Ensure that the TOC never has a horizontal scrollbar (test super long section headings, specifically when opening the TOC from the sticky header)

Developer notes

Due to the variety of positions the collapsed TOC can occupy (in the page title, the sticky header, and floating) across multiple viewports, we decided to use a max-width of min( 51em, 75vw), where 51 is 85% of the main content width (60em), and 75vw is used on smaller viewports to ensure the menu never fully covers the text. This CSS value needs to be adjusted for the sticky header due to the specifics of how its positioned, but it results in the same resulting width.

QA Results - Beta

QA Results - Prod

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
ovasileva raised the priority of this task from Medium to High.Aug 24 2022, 5:39 PM
Jdlrobson subscribed.

I'm a little confused about this task. It looks like the width of the table of contents is set to 220px so it's max width is the explicit width being set. What is being asked for here?

Screen Shot 2022-08-29 at 10.58.26 AM.png (1×1 px, 664 KB)

I'm a little confused about this task. It looks like the width of the table of contents is set to 220px so it's max width is the explicit width being set. What is being asked for here?

Screen Shot 2022-08-29 at 10.58.26 AM.png (1×1 px, 664 KB)

This task assumes that 220px limited width has already been removed.

(Context: sometime in the past two weeks we decided that the 220px limited width was a bug...I thought it had already been removed in a task/patch somewhere. If not, and no tasks exists for that, we should modify this task to be about increasing the max-width of the TOC when it's in a menu).

There is no task for removing the 220px limit that I am aware of, so I've folded that into the acceptance criteria. When removed the width would adjust to the contents, with the current max-width set to 100% like so:.

Screen Shot 2022-08-29 at 3.52.41 PM.png (1×2 px, 302 KB)

What should the new max width be?

Would it also need a min-width?

alexhollender_WMF renamed this task from [Visual refinements] Add max-width to TOC (menu version) to [Visual refinements] Change max-width of TOC (menu version).Aug 29 2022, 10:54 PM
alexhollender_WMF updated the task description. (Show Details)
alexhollender_WMF updated the task description. (Show Details)

There is no task for removing the 220px limit that I am aware of, so I've folded that into the acceptance criteria. When removed the width would adjust to the contents, with the current max-width set to 100% like so:.

Screen Shot 2022-08-29 at 3.52.41 PM.png (1×2 px, 302 KB)

What should the new max width be?

Would it also need a min-width?

ok thanks. I've updated the task description regarding the max-width (95%).

Regarding a min-width, good question. In the screenshot below I've removed the min-width from the TOC menu...the Contents [move to sidebar] element kind of takes care of providing a min-width. Not sure if we should still specify one? Maybe we can wait for the design system's team feedback on T316055: Establish min & max widths for menus. Example page: https://en.wikipedia.org/wiki/User:AHollender_(WMF)/sandbox/Short_section_title_test

Screen Shot 2022-08-29 at 7.00.56 PM.png (872×1 px, 231 KB)

When I added max-width: 95% to prod to test this solution, I noticed a horizontal scrollbar and some text being cutoff. Seems to only happen in FF. If others can reprod this I think it would be good for this task to include a fix for that.

bwang removed bwang as the assignee of this task.Sep 9 2022, 8:09 PM
bwang moved this task from Doing to Code Review on the Web-Team-Backlog (Kanbanana-2022-23-Q1) board.

Change 831127 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] Follow-up: Clean up sticky header and collapsed TOC styles

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

Change 831127 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] Follow-up: Clean up sticky header and collapsed TOC styles

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

Suggest blocking this until next branch cut given the amount of visual changes currently on next week's train and Pixel not being in a stable state.

Change 831126 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] Update collapsed TOC menu width

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

just chatted with @bwang, two notes:

  • decided to go with 85% of the content width so that there is a bit more of the article showing behind the TOC
  • @bwang pointed out that we need to define the max-width differently for the cases where the TOC is opened from the sticky header, and when it's opened from the floating button (when you're scrolled down on the page), since the TOC is in a different container and setting it to 85% doesn't have the same affect. Also noted that there is no way to ensure that the TOC in those cases is the same width as it is in the case where you open it from the page title
from sticky header (max-width: 70vw)from floating button (max-width: 70vw)
Screen Shot 2022-09-12 at 4.00.54 PM.png (800×1 px, 182 KB)
Screen Shot 2022-09-12 at 3.55.26 PM.png (804×952 px, 168 KB)

also to note: it seems that when opening the TOC from the sticky header, if there is a super long section heading a horizontal scrollbar appears

Screen Shot 2022-09-12 at 4.52.09 PM.png (1×1 px, 350 KB)

@alexhollender_WMF Do we want to apply a min width? Depending on the contents of the TOC it's possible to have a very thin menu. Maybe a min-width: 200px?

Screen Shot 2022-09-15 at 12.06.47 PM.png (598×312 px, 51 KB)

@alexhollender_WMF Do we want to apply a min width? Depending on the contents of the TOC it's possible to have a very thin menu. Maybe a min-width: 200px?

Screen Shot 2022-09-15 at 12.06.47 PM.png (598×312 px, 51 KB)

yes, min-width: 200px sounds good. My initial assumption was the Contents [move to sidebar] element provided a sort of implicit min-width, though in the future [move to sidebar] could become an icon, or in other languages that whole element might be much shorter.

bwang reassigned this task from Edtadros to alexhollender_WMF.
bwang moved this task from Code Review to QA on the Web-Team-Backlog (Kanbanana-2022-23-Q1) board.
bwang moved this task from QA to Design Review on the Web-Team-Backlog (Kanbanana-2022-23-Q1) board.

Change 831126 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Update collapsed TOC menu width

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

yes, min-width: 200px sounds good. My initial assumption was the Contents [move to sidebar] element provided a sort of implicit min-width, though in the future [move to sidebar] could become an icon, or in other languages that whole element might be much shorter.

@alexhollender_WMF right, and the other thing to note is that the "move to sidebar" button goes away on narrow viewports as well.

This is now in beta cluster, would you be able to take a look really quick? I still have to merge the part about adding min-width, but thats fairly straightforward and I think I'd mainly want you to take a look at the max-width in the different collapsed TOC cases and on different screensizes.

This is now in beta cluster, would you be able to take a look really quick? I still have to merge the part about adding min-width, but thats fairly straightforward and I think I'd mainly want you to take a look at the max-width in the different collapsed TOC cases and on different screensizes.

looking good so far

Screen Shot 2022-09-15 at 3.40.43 PM.png (793×1 px, 289 KB)
Screen Shot 2022-09-15 at 3.41.18 PM.png (795×1 px, 211 KB)
Screen Shot 2022-09-15 at 3.41.32 PM.png (794×948 px, 197 KB)

Change 832551 had a related patch set uploaded (by Jdlrobson; author: Bernard Wang):

[mediawiki/skins/Vector@wmf/1.40.0-wmf.1] Update collapsed TOC menu width

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

Change 832533 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] Follow-up: Apply min-width to collapsed TOC

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

bwang renamed this task from [Visual refinements] Change max-width of TOC (menu version) to [Visual refinements] Change width of TOC (menu version).Sep 16 2022, 4:28 PM
bwang reassigned this task from alexhollender_WMF to Jdrewniak.
bwang updated the task description. (Show Details)

Change 831127 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Follow-up: Clean up sticky header and collapsed TOC styles

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

Change 832533 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Follow-up: Apply min-width to collapsed TOC

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

Test Result - Beta

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

Test Artifact(s):

QA Steps

✅ AC1: The collapsed TOC menu no longer has a 220px fixed width
✅ AC2: The TOC menu has a max-width equaling 85% of the main content text (51em) when collapsed into the page title.
✅ AC3: The TOC menu has the same behavior when collapsed into other locations (i.e. the sticky header, floating on narrow screens)
✅ AC4: On narrow screens the TOC menu still never covers the text completely (uses 75vw)
✅ AC5: The TOC menu has a min width of 200px
✅ AC6: Ensure that the TOC never has a horizontal scrollbar (test super long section headings, specifically when opening the TOC from the sticky header)

Screen Shot 2022-09-29 at 6.29.17 AM.png (1×499 px, 258 KB)

Screen Shot 2022-09-29 at 6.25.28 AM.png (1×1 px, 314 KB)

Screen Shot 2022-09-29 at 6.26.44 AM.png (1×999 px, 427 KB)

Screen Shot 2022-09-29 at 6.27.47 AM.png (1×1 px, 483 KB)

Test Result - Prod

Status: ✅ PASS
Environment: testwiki
OS: macOS Monterey
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

✅ AC1: The collapsed TOC menu no longer has a 220px fixed width
✅ AC2: The TOC menu has a max-width equaling 85% of the main content text (51em) when collapsed into the page title.
✅ AC3: The TOC menu has the same behavior when collapsed into other locations (i.e. the sticky header, floating on narrow screens)
✅ AC4: On narrow screens the TOC menu still never covers the text completely (uses 75vw)
✅ AC5: The TOC menu has a min width of 200px
✅ AC6: Ensure that the TOC never has a horizontal scrollbar (test super long section headings, specifically when opening the TOC from the sticky header)

Screen Shot 2022-09-29 at 6.38.20 AM.png (1×502 px, 230 KB)

Screen Shot 2022-09-29 at 6.37.47 AM.png (1×914 px, 406 KB)

Screen Shot 2022-09-29 at 6.37.13 AM.png (1×1 px, 443 KB)

Screen Shot 2022-09-29 at 6.36.23 AM.png (1×1 px, 474 KB)