Stack sticky PR tabs above revision-diff toolbar on File Changes #2993
Service Desk opened 1 day ago

Follow-up from issue #2990 (design locked).

Locked decisions (from issue #2990)

  1. Scope: Pull request File Changes only (other PR tabs already sticky).
  2. Behavior: Both bars sticky and stacked — primary PR tabs stay at the top; Filter by path / Diff options stay immediately under them with no overlap.
  3. Out of scope: Build / Issue parity smoke beyond PR File Changes.

Problem

.sticky-tabs-row is sticky globally, but base.css intentionally disables it when a revision diff is present:

html:has(.revision-diff) .sticky-tabs-row {
  position: static;
}
html:has(.revision-diff) .sticky-tabs-row.is-docked>.more-info-dock {
  display: none;
}

PR File Changes embeds RevisionDiffPanel (.revision-diff). That exception lets .revision-diff > .head own top: 0 alone (from issue #2954 / issue #2969). Product now wants both bars sticky and stacked.

Do not “fix” this by adding Bootstrap .position-sticky / !important on the tab row — that only overrides the exception and leaves both bars at top: 0.

Goal

On PR File Changes, after scrolling:

  1. Primary tab labels (Activities / File Changes / …) + docked more-info stay pinned at top: 0.
  2. Revision-diff toolbar (Filter by path, Diff options, …) stays pinned immediately under that row.
  3. Neither bar covers the other.

Implementation plan

1. Re-enable sticky tabs when .revision-diff is present

In base.css:

  • Remove (or reverse) html:has(.revision-diff) .sticky-tabs-row { position: static; }.
  • Remove (or reverse) html:has(.revision-diff) .sticky-tabs-row.is-docked>.more-info-dock { display: none; } so the more-info dock can appear again while Changes is sticky.
  • Review the older sibling rule html:has(.revision-diff) .nav-tabs-line.nav-tabs-sticky { position: static; } and keep it consistent (legacy marker vs .sticky-tabs-row).

2. Offset .revision-diff > .head under the sticky tab row

In revision-diff.css, .revision-diff > .head is currently:

.revision-diff>.head {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  …
}

Set top to the live height of .sticky-tabs-row (not a hard-coded guess only), so the path-filter bar sits flush under the tabs.

Because the tab row height can change (wrap, docked more-info, font zoom), sync via JS (resize / ResizeObserver on the sticky row), e.g. from revision-diff.js or PR detail JS:

  • head.style.top = stickyRow.offsetHeight + "px" (or equivalent).
  • Keep z-index of .sticky-tabs-row (990) above .revision-diff > .head (10) so stacking order matches visual order.

3. Fix scroll anchoring for in-diff jumps

revision-diff.js currently sets:

$(".revision-diff>.body li.diff, …")
  .css("scroll-margin-top", $(".revision-diff>.head").outerHeight() + "px");

Include sticky-tab-row height as well (tabs + head), otherwise “jump to file” / active navigation can land under the stacked sticky bars.

4. Manual verification (PR detail only)

On a PR with a non-trivial File Changes view:

  •  Deep scroll: tab labels stay at top; Filter by path / Diff options stay directly under them with no overlap.
  •  Tab wrap / narrow width: head top still matches sticky-row height.
  •  More-info dock appears when header more-info scrolls away; side-info open/close still hides triggers correctly.
  •  Activities / Commits / Builds / Code Comments unchanged (still sticky as today).
  •  In-diff navigation / path jumps clear both sticky bars (scroll-margin-top).

Non-goals

  • Bootstrap .position-sticky / !important as the long-term fix.
  • Changing sticky behavior on Issue / Build detail pages (issue #2990 Q3=A).
  • Robin Shen commented 1 day ago

    Tab headers of File Changes is intentionally not sticked as otherwise the sticky headers (and other headers above it) takes too much space, and the file review part can be too small, especially on a notebook.

  • Service Desk commented 1 day ago

    Closing without implementation: keep File Changes tab row non-sticky so the revision-diff toolbar does not stack under primary tabs and reduce review viewport height (especially on notebooks). Supersedes the issue #2990 2=B lock.

  • Service Desk commented 1 day ago

    @robin Agreed — that matches the intentional html:has(.revision-diff) exception from issue #2954 / issue #2969, and was also the recommendation in issue #2990 (keep File Changes tabs non-sticky so the revision-diff toolbar owns top: 0 and review viewport height stays usable).

    issue #2993 was opened only because issue #2990 locked 2=B (both sticky, stacked) per @zaakiy. Given the notebook/space concern, we should keep current behavior and close this Improvement without implementation.

    @zaakiy FYI — product direction here keeps the primary PR tab row scrolling away on File Changes so Filter by path / Diff options stay sticky without stacking a second bar that shrinks the review area.

  • Service Desk changed state to 'Closed' 1 day ago
    Previous Value Current Value
    Open
    Closed
  • Zak Siddiqui commented 17 hours ago

    Hi. @robin I was actually thinking of a way to achieve this without using two separate rows of sticky divs.

    We could put them side by side as you scroll down and use view transitions to neatly transition the items

    CSS Can Now Animate Between Pages

    The above video shows how to use view transitions between two different pages, but of course you can use it within a single page as well.

    When I have some time, I'll create an issue for this.

  • Zak Siddiqui commented 17 hours ago

    (I will also make sure that it is still nice and neat on mobile devices as well.)

1/1
Type
Improvement
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-2993
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover