Page MenuHomePhabricator

Make collapsed ToC available when scrolled down the page
Closed, ResolvedPublic5 Estimated Story Points

Description

Background

See T306660: [Goal] Table of contents on narrow screens in vector-2022

Description

In T307900 and T307901 we are making the table of contents collapsible. When you are at the top of the page and the table of contents is collapsed, it will be accessible via an icon-button located next to the page title. This task is about making the collapsed table of contents icon-button available when you are scrolled down the page (past the page title).

Design

There are two different situations to handle:

1. No sticky header present (this includes all logged-out people, and logged-in people on screens less than 1000px wide)

closedopen
image.png (1×2 px, 1 MB)
image.png (1×2 px, 1021 KB)

2. Sticky header present (this includes all logged-in people on screens more than 1000px wide) << covered by T311103
Note: the difference here is that logged-in people have a sticky header

closedopen
image.png (1×2 px, 1 MB)
image.png (1×2 px, 1 MB)

Developer notes

Seems like this can be done without any major CSS or JS changes.
Much of the prework is done in https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/794029

Acceptance criteria

  • The table of contents icon (mw-toc-button) should be marked with the mw-sticky-header-element class << T311103
  • TOC in js context appears lower down on the page after scrolling or clicking on a TOC section from the top of the page.

QA steps

  • Beta cluster link TK
  • Verify that above desktop (1000px) view port, sticky TOC behaves as it does currently on production.
  • Between tablet (720px) and desktop (1000px) view ports:
    • Verify that clicking on a TOC section navigates the user to that section with the collapsed TOC icon sticky in the sidebar (for both sidebar menu expanded/collapsed states)
    • Verify that the collapsible TOC icon is navigable via keyboard tabs when lower down on page:
      • Tabbing to TOC icon and hitting "Enter" will toggle the TOC open/closed
    • Below tablet (720px) view port:
      • Verify above steps but note that sidebar menu collapses full width above main content so there is no expanded sidebar container state for the expanded/collapsed TOC.
    • For the no-js context - note that:
      • the TOC headings will not be collapsed.
      • there is no TOC lower down on the page.
  • Cross-check in other supported browsers.

QA Results - Beta

QA Results - Prod

Event Timeline

ovasileva triaged this task as Medium priority.May 19 2022, 8:20 AM
Jdlrobson updated the task description. (Show Details)

Noted in T307900#7964376 -- pending merge over there, 1st use case should be covered.

Although I'm unclear if design should change - here icon overlaps content. In other task, it lives in its own narrow column.
@alexhollender_WMF mind confirming?

@Jdlrobson I realized that the second case in the description (i.e. collapsed TOC in the sticky header) isn't possible until T307901 is complete. On viewports greater than 1000px the TOC is sticky on the side by default. Without the hide button completed there will be 2 TOCs on larger screen sizes. The work involved in getting the TOC in the sticky header is pretty distinct from the first case anyway, so I'd recommend splitting that into a separate ticket.

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

[mediawiki/skins/Vector@master] Add support for floating TOC lower down the page

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

bwang removed bwang as the assignee of this task.Jun 17 2022, 3:20 PM
bwang moved this task from Doing to Code Review on the Web-Team-Backlog (Kanbanana-FY-2021-22) board.
bwang subscribed.

erring on moving this back to Ready for Dev because I think the 2nd use case still needs addressing?

actually given @bwang's previous comment maybe part 2 needs a new ticket

cjming added a subscriber: Edtadros.
cjming updated the task description. (Show Details)

Opened T311103 for the 2nd design use use outlined in this ticket so moving this ticket to QA

Change 804621 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Add support for floating TOC lower down the page

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

@bwang @cjming according to a report we're seeing the toggle icon AND the table of contents in the sidebar on certain mobile devices:

image.png (2×1 px, 684 KB)

Could this relate to the max-width/min-width discussion you were having last week?

Test Result - Beta

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

Test Artifact(s):

QA Steps
  • Beta cluster link TK
  • ✅ AC1: Verify that above desktop (1000px) view port, sticky TOC behaves as it does currently on production.
    • Verified with sidebar collapsed, expanded, scrolling toc, non-scrolling toc, section "highlighting", clicking items, and expanding/collapsing sections, and visual similarity to Prod.
  • Between tablet (720px) and desktop (1000px) view ports:
    • ✅ AC2: Verify that clicking on a TOC section navigates the user to that section with the collapsed TOC icon sticky in the sidebar (for both sidebar menu expanded/collapsed states)
      Screen Recording 2022-06-26 at 3.54.37 PM.mov.gif (618×528 px, 1 MB)
    • Verify that the collapsible TOC icon is navigable via keyboard tabs when lower down on page:
      • ✅ AC3: Tabbing to TOC icon and hitting "Enter" will toggle the TOC open/closed
        Screen Recording 2022-06-26 at 3.26.01 PM.mov.gif (998×984 px, 830 KB)
    • Below tablet (720px) view port:
      • ✅ AC4: Verify above steps but note that sidebar menu collapses full width above main content so there is no expanded sidebar container state for the expanded/collapsed TOC.
        Screen Recording 2022-06-26 at 3.28.40 PM.mov.gif (998×680 px, 1 MB)
    • ✅ AC5: For the no-js context - note that:
      • the TOC headings will not be collapsed.
      • there is no TOC lower down on the page.
Screen Recording 2022-06-26 at 3.35.20 PM.mov.gif (526×638 px, 1 MB)
Screen Recording 2022-06-26 at 3.37.20 PM.mov.gif (826×436 px, 2 MB)
Screen Recording 2022-06-26 at 3.46.29 PM.mov.gif (826×436 px, 2 MB)
  • ✅ AC6: Cross-check in other supported browsers. -Validated safari and firefox

@bwang @cjming according to a report we're seeing the toggle icon AND the table of contents in the sidebar on certain mobile devices:
Could this relate to the max-width/min-width discussion you were having last week?

thanks @Jdlrobson I can't recall where we discussed this but I think this is the case and we have a ticket to address T310536

ovasileva raised the priority of this task from Medium to High.Jul 1 2022, 4:54 PM

Test Result - Prod

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

Test Artifact(s):

QA Steps
  • Beta cluster link TK
  • ✅ AC1: Verify that above desktop (1000px) view port, sticky TOC behaves as it does currently on production.
    • Verified with sidebar collapsed, expanded, scrolling toc, non-scrolling toc, section "highlighting", clicking items, and expanding/collapsing sections, and visual similarity to Prod.
  • Between tablet (720px) and desktop (1000px) view ports:
    • ✅ AC2: Verify that clicking on a TOC section navigates the user to that section with the collapsed TOC icon sticky in the sidebar (for both sidebar menu expanded/collapsed states)
      Screen Recording 2022-07-02 at 9.56.07 PM.mov.gif (862×942 px, 3 MB)
    • Verify that the collapsible TOC icon is navigable via keyboard tabs when lower down on page:
      • ✅ AC3: Tabbing to TOC icon and hitting "Enter" will toggle the TOC open/closed
        Screen Recording 2022-07-02 at 9.57.15 PM.mov.gif (862×942 px, 907 KB)
    • Below tablet (720px) view port:
      • ✅ AC4: Verify above steps but note that sidebar menu collapses full width above main content so there is no expanded sidebar container state for the expanded/collapsed TOC.
        Screen Recording 2022-07-02 at 9.58.19 PM.mov.gif (862×694 px, 1 MB)
    • ✅ AC5: For the no-js context - note that:
      • the TOC headings will not be collapsed.
      • there is no TOC lower down on the page.
Screen Shot 2022-07-02 at 10.06.49 PM.png (862×690 px, 328 KB)
Screen Shot 2022-07-02 at 10.07.07 PM.png (860×937 px, 401 KB)
Screen Shot 2022-07-02 at 10.07.35 PM.png (862×1 px, 486 KB)
  • ✅ AC6: Cross-check in other supported browsers. -Validated safari and firefox

Looks good, resolving!