Page MenuHomePhabricator

Sticky section headers overlap when a multi-line header scrolls behind a shorter sticky header
Closed, ResolvedPublic3 Estimated Story Points

Description

Problem

When users scroll through an article with collapsible sticky section headers, if a multi-line (taller) header scrolls behind a shorter (single-line) header, the taller header peeks through underneath during the sticky transition. This creates a distracting visual glitch and reduces clarity of which section is currently in view.

Steps to Reproduce

Visit an article with collapsible sticky section headers enabled (e.g., Swan Maiden).
Locate two adjacent section headers where:
The first header takes multiple lines
The following header is one line
Scroll so the taller header becomes sticky, then continue scrolling down into the next section.
Observe that the taller header visually bleeds through under the shorter sticky header.

Expected Behavior

While scrolling, only the current sticky header should be visible.
No part of previously sticky headers should remain visible underneath.

Actual Behavior

Taller section headers visually overlap and peek out underneath when scrolling past them.

Acceptance Criteria

A clean solution that ensures:

  • Only one sticky header is visible at any time while scrolling
  • No overlapping content appears during sticky transitions
  • Behavior remains smooth and predictable regardless of header height

Suggested Implementation Notes

  • A CSS-only solution is preferred if possible.
  • One explorative idea discussed: automatically truncate headers to a single line while sticky to normalize height.
  • JavaScript can be used if absolutely necessary, but should not introduce layout thrashing or excessive scroll listeners.

Screenshot 2025-11-18 at 11.54.40 AM.png (700×678 px, 112 KB)

Event Timeline

lwatson subscribed.
HSwan-WMF set the point value for this task to 3.Nov 19 2025, 5:26 PM

Change #1210539 had a related patch set uploaded (by Matthias Mullie; author: Matthias Mullie):

[mediawiki/extensions/ReaderExperiments@master] Move away sticky headers for content no longer in viewport

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

Change #1210539 merged by jenkins-bot:

[mediawiki/extensions/ReaderExperiments@master] Move away sticky headers for content no longer in viewport

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

I can't seem to reproduce on Beta, will wait for the patch to land on group 2 wikis.

Should I backport the patch to wmf.3 for group2 today or shall we just wait until group2 rolls out wmf.4? I assume that should be coming soon.

group2 is now on wmf.4 and I can confirm that the fix works in https://en.wikipedia.org/wiki/Swan_maiden?stickyHeaders=1.
Also checked https://fr.wikipedia.org/wiki/R%C3%A9publique?stickyHeaders=1 on French Wikipedia:

stickyheaders.gif (1×842 px, 3 MB)