Page MenuHomePhabricator

[Table of Contents] Offset the top position of the table of contents to the height of the sticky header only when the sticky header is/will be shown
Closed, ResolvedPublic2 Estimated Story Points

Description

Description

Currently, the table of contents assumes that the sticky header is always shown and offsets its top property to account for the sticky header's height. For example, login and visit https://en.wikipedia.beta.wmflabs.org/wiki/Dog?tableofcontents=1&vectorstickyheader=0 and then scroll down the page:

Screen Shot 2022-02-14 at 5.25.50 PM.png (2,850×1,388 px, 1 MB)

However, the sticky header may not be enabled or may not be enabled for specific pages. Therefore, we need to make this offset conditional and based on whether the sticky header is/will be shown.

Acceptance Criteria

  • Table of contents offsets its top position to account for the sticky header's height only when the sticky header is/will be shown

Developer Notes

The sticky header has a utility class .mw-sticky-header-element that we could make use of here:

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

QA Results - Prod

ACStatusDetails
1T300077#7740507

Event Timeline

@nray note that once we do T298836 the sticky header will be hidden below 1000px, so the change described in this task should only apply to windows wider than 1000px.

@alexhollender_WMF I think beta already has the effect you are looking for with the sticky header, is that correct?: https://en.wikipedia.beta.wmflabs.org/wiki/Dog?tableofcontents=1&vectorstickyheader=1

We should, however, adjust the TOC styles to not apply an offset for the sticky header height if the sticky header isn't present though e.g.: https://en.wikipedia.beta.wmflabs.org/wiki/Dog?tableofcontents=1&vectorstickyheader=0

@alexhollender_WMF I think beta already has the effect you are looking for with the sticky header, is that correct?: https://en.wikipedia.beta.wmflabs.org/wiki/Dog?tableofcontents=1&vectorstickyheader=1

yup, looks great on beta:

We should, however, adjust the TOC styles to not apply an offset for the sticky header height if the sticky header isn't present though e.g.: https://en.wikipedia.beta.wmflabs.org/wiki/Dog?tableofcontents=1&vectorstickyheader=0

yes — do you want a separate task for that?

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

[mediawiki/skins/Vector@master] Offset the TableOfContents `top` property only when the sticky header is shown

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

Change 762559 abandoned by Nray:

[mediawiki/skins/Vector@master] Offset the TableOfContents `top` property only when the sticky header is shown

Reason:

POC

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

Change 762559 restored by Nray:

[mediawiki/skins/Vector@master] Offset the TableOfContents `top` property only when the sticky header is shown

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

Change 762559 abandoned by Nray:

[mediawiki/skins/Vector@master] Offset the TableOfContents `top` property only when the sticky header is shown

Reason:

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

nray renamed this task from [Sticky header] increase top distance on ToC for logged-in people to [Table of Contents] Offset the top position of the table of contents to the height of the sticky header only when the sticky header is/will be shown.Feb 15 2022, 12:30 AM
nray removed nray as the assignee of this task.
nray updated the task description. (Show Details)
nray subscribed.

Change 762559 restored by Nray:

[mediawiki/skins/Vector@master] Offset the TableOfContents `top` property only when the sticky header is shown

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

Change 762559 abandoned by Nray:

[mediawiki/skins/Vector@master] Offset the TableOfContents `top` property only when the sticky header is shown

Reason:

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

Change 762559 restored by Bernard Wang:

[mediawiki/skins/Vector@master] Offset the TableOfContents `top` property only when the sticky header is shown

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

bwang removed bwang as the assignee of this task.Feb 17 2022, 6:28 PM
bwang subscribed.

Change 762559 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Offset the TableOfContents `top` property only when the sticky header is shown

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

Edtadros subscribed.

Test Result - Prod

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

Test Artifact(s):

QA Steps

✅ AC1: Table of contents offsets its top position to account for the sticky header's height only when the sticky header is/will be shown

Screen Shot 2022-02-27 at 9.29.45 PM.png (1,060×442 px, 138 KB)

Screen Shot 2022-02-27 at 9.30.23 PM.png (1,059×558 px, 214 KB)

Looks good, resolving.