Question about sticky tab row in pull requests #2990
Zak Siddiqui opened 8 hours ago

OD-2969 was intended to change the navigation tabs to be sticky for both issues and pull requests. It was successful for issues but not for pull requests. Perhaps this is because the DOM for pull requests is slightly different.

After investigating, I found that the solution is to add .position-sticky to the same div that contains .sticky-tabs-row for pull requests.

Please

  1. Investigate and validate - provide alternative options if that may be considered.
  2. Create an implementation plan
  3. close this issue and create a separate implementation issue.

Don't assume. Ask high-level clarifying questions if needed.

  • Numbered questions (1, 2, 3, etc)
  • Lettered answer options (A, B, C, etc)
  • Include a markdown table that contains the following for each question:
    • Pros and Cons?
    • Your recommendation (including justification)?
  • Service Desk commented 8 hours ago

    Investigation (issue #2969 / sticky tabs on PRs)

    Validation of current code

    Pull request detail already uses the same sticky-row markup as issue detail:

    <div class="sticky-tabs-sentinel …"></div>
    <div class="sticky-tabs-row d-flex align-items-center mb-5">
      <ul … class="tabs nav nav-tabs nav-tabs-line …"></ul>
      <a … class="more-info side-info more-info-dock …"></a>
    </div>
    

    And base.css already sets sticky on that row:

    .sticky-tabs-row {
      position: sticky;
      top: 0;
      z-index: 990;
      …
    }
    

    So adding Bootstrap .position-sticky is not filling a missing sticky declaration on PR pages. .sticky-tabs-row already has position: sticky. Bootstrap .position-sticky is position: sticky !important, which mainly changes cascade priority.

    Likely root cause of “works on issues, not on PRs”

    There is an intentional exception from issue #2954 / issue #2969:

    html:has(.revision-diff) .sticky-tabs-row {
      position: static;
    }
    
    • Issue detail pages rarely contain .revision-diff, so .sticky-tabs-row stays sticky.
    • PR File Changes embeds RevisionDiffPanel (.revision-diff). That rule forces the tab row back to position: static.
    • .revision-diff > .head is itself sticky at top: 0 (diff toolbar / path filter). Sticky nav tabs were disabled so they would not compete with that sticky diff head.

    That also explains why adding .position-sticky can “fix” File Changes: !important overrides the position: static exception and re-enables sticky tabs even when a revision diff is present.

    On PR tabs without .revision-diff (Activities, Commits, Builds, Code Comments), sticky should already match issue detail. If those tabs also fail to stick, that would be a different bug than the revision-diff exception.

    Alternatives (if File Changes sticky is desired)

    ApproachProsCons
    A. Add .position-sticky / !important on .sticky-tabs-row (proposed)Minimal markup change; overrides the static exceptionReintroduces sticky-on-Changes; two sticky bars at top: 0 (nav row + .revision-diff > .head) can overlap / fight; hides intent of the existing CSS exception
    B. Keep exception; document as intentionalPreserves revision-diff sticky toolbar UX from issue #2954File Changes tab bar still scrolls away
    C. Re-enable sticky tabs on Changes, offset revision-diff head (top ≈ sticky-tabs-row height; sync on resize/wrap)Both bars stay reachable; no !important hackMore CSS/JS; must handle wrap / docked more-info height; easy to drift
    D. Narrow the exception (e.g. only disable when .revision-diff is in view / only on PullRequestChangesPage with a clearer page-scoped rule)Clearer intent than global html:has(...)Does not by itself make Changes sticky; still need B or C for product behavior

    Recommendation (pending Q1–Q2): Prefer B if the observed failure is File Changes only (current design). Prefer C if sticky primary tabs on File Changes are a product requirement. Avoid A as the long-term fix because it only wins via !important and does not solve sticky stacking with the diff toolbar.

    Clarifying questions

    1. On which pull request tabs is the sticky tab row failing?

    OptionMeaning
    AFile Changes only
    BAll PR tabs (Activities / Commits / Builds / Code Comments / File Changes)
    CSome non-Changes tabs as well (please name them)
    Pros / ConsA matches the html:has(.revision-diff) explanation and keeps scope small. B/C imply a separate layout/scroll bug (not fixed by .position-sticky alone).
    RecommendationA, based on code review — please confirm against a live PR.

    2. If File Changes is in scope, should primary tabs stick while the revision-diff toolbar is also sticky?

    OptionMeaning
    ANo — keep today’s exception (tabs scroll away on File Changes)
    BYes — both sticky; offset .revision-diff > .head under the tab row (approach C above)
    CYes — force sticky tabs only (approach A); accept overlap risk with the diff head
    Pros / ConsA safest for diff UX. B best product outcome if both bars must stay visible. C cheapest but fragile.
    RecommendationA unless you explicitly want sticky primary tabs on File Changes; then B.

    3. Should the follow-up implementation issue also cover Build detail parity / regression checks?

    OptionMeaning
    APR detail only
    BPR + Build + Issue smoke checks for sticky row + more-info dock
    Pros / ConsA smaller. B safer because sticky row / dock logic is shared in base.css + side-info.js.
    RecommendationB.

    Provisional implementation plan (after answers)

    1. Confirm failing tabs (Q1) on a live PR.
    2. If Q1=A and Q2=A: no code change; document exception; close with Related link only if needed.
    3. If Q2=B: open an Improvement to re-enable sticky tabs on Changes and offset .revision-diff > .head by sticky-row height; update html:has(.revision-diff) rules; verify more-info dock + wrap.
    4. If Q1=B/C: investigate scroll/overflow ancestors on PR detail (separate from .position-sticky); do not treat Bootstrap .position-sticky as the fix.
    5. After direction is locked: create the implementation issue, link it as Related, and close this Question.

    @zaakiy please answer 1 / 2 / 3 with letter choices so we can open the implementation issue with the correct scope.

  • Zak Siddiqui commented 8 hours ago
    1. a
    2. I need some more specific clarification on what you mean. Try to give examples of exactly what text content I should look for.
    3. a

    @servicedesk

  • Service Desk commented 8 hours ago

    @zaakiy Thanks — noted 1=A (File Changes only) and 3=A (PR detail only).

    Clarifying question 2 with concrete UI text

    On a pull request File Changes page, after you scroll down far enough that the PR title / merge buttons are off-screen, there are two separate toolbars involved:

    Bar 1 — primary PR tabs (the row with these tab labels):

    • Activities
    • File Changes
    • Commits / Builds (whichever appear for that PR)
    • Code Comments
    • plus the (More info) control on the right

    Bar 2 — revision-diff toolbar (directly above the file diffs; look for this controls text):

    • placeholder / field: Filter by path
    • tooltips / controls: Diff options (gear), Download patch, Toggle navigation
    • optionally: Batched suggestions, and a review progress percentage label

    Today’s intentional CSS exception keeps Bar 2 sticky at the top of the viewport while you scroll the diffs, and lets Bar 1 scroll away so the two bars do not compete for top: 0.

    2. When scrolling File Changes, what should stick?

    OptionWhat you should observe after scrolling deep into the diffs
    AKeep current behavior. Filter by path / Diff options (Bar 2) stays pinned at the top. The Activities / File Changes / Code Comments tab labels (Bar 1) scroll off-screen.
    BBoth sticky, stacked. Tab labels (Bar 1) stay pinned at the very top; Filter by path / Diff options (Bar 2) stay pinned immediately under those tabs. Neither covers the other.
    CForce sticky tabs only. Tab labels (Bar 1) stay pinned, but may overlap or fight with Filter by path / Diff options (Bar 2) because both try to sit at the top.
    Pros / ConsA safest for the diff toolbar UX (current design). B best if you want to switch tabs without scrolling back up. C cheapest but can hide/overlap the path filter.
    RecommendationA unless sticky primary tabs on File Changes are a product requirement; then B.

    Please reply with 2=A, 2=B, or 2=C. After that we can close this Question and open the implementation issue with the correct scope (or close with no code change if 2=A).

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