Skip to content

Collapse the sticky label slot for non-sticky section headers - #3862

Merged
ymichael merged 2 commits into
mainfrom
bb/fix-sidebar-discord-row-scrolling-thr_yatghhu7cu
Sep 17, 2026
Merged

ymichael merged 2 commits into
mainfrom
bb/fix-sidebar-discord-row-scrolling-thr_yatghhu7cu

Conversation

@ymichael

@ymichael ymichael commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Two defects in the sidebar's sticky stack (apps/app/src/components/ui/theme.css), the second exposed by fixing the first.

  1. Every tier offset derives from one chain: --bb-sidebar-sticky-label-top → --bb-sidebar-sticky-project-top (label top + label height + label gap) → --bb-sidebar-sticky-parent-base-top → per-level parent-stride. That chain assumes each section pins its own label. BuiltInSidebarSection passes stickyHeader={false} for Pinned (added in Unify thread-list header actions and nested view controls #3402, "Pinned now scrolls with its contents"), so its label renders relative top-auto and scrolls away — but the offsets below it still reserved the label's slot. An expanded pinned parent thread therefore froze 36px below the top of the scroll area with a dead band above it that the other pinned rows scrolled through. It only surfaces when a pinned root has children and is expanded, which is the only case where a pinned row becomes a sticky tier.
  2. The stack's top padding is inside the scrollport, so rows stay visible while they scroll through it. A sticky label hides that strip behind its own opaque ::before shield; a pinned parent row has no top shield, because until (1) was fixed something sticky was always above it. With the row now flush at the padding, the child scrolling underneath showed through the strip above it — measured at scrollTop: 160, the stuck row spans 8–36px while its first child spans −4–24px, leaving that child's 0–8px slice visible.

What changed

  • apps/app/src/components/sidebar/TopLevelSidebarSection.tsx: the section's SidebarStickyGroup root now exposes data-sidebar-sticky-header="false" when stickyHeader is false (attribute absent in the sticky default, so no markup churn for the common case).
  • apps/app/src/components/ui/theme.css: one rule collapses --bb-sidebar-sticky-project-top to --bb-sidebar-sticky-stack-padding-top for those groups. Since project-top is the origin the parent base and every parent level derive from, this corrects the project tier and all parent depths at once, and composes with the existing [data-sidebar-sticky-section] rule that drops the parent base onto project-top for label → parent trees like Pinned.
  • apps/app/src/components/ui/theme.css: [data-sidebar-sticky-stack]::before adds one sticky cap the height of the stack's top padding, pulled over the strip with a negative top margin. Layout is unchanged (row rects measure identically before and after) and it is invisible at rest. It keys off the stack rather than any one tier, so it covers labels, project rows, and parent rows alike.

CSS and data-attribute only: no JS measurement, no wire or CLI surface changes, so no HOST_DAEMON_PROTOCOL_VERSION bump.

How you verified

Reproduced first in Ladle (sidebar--overview--overview) and then confirmed both fixes against a pnpm start:worktree production build driven with dev-browser, measuring each row's offset from the top of the scroll container.

Sticky offset of an expanded pinned parent (430px, pointer: coarse):

scrollTop before after
40 36px, dead band above 8px, flush
140 36px, dead band above unstuck, in flow
280 (4-level chain) n/a 8 / 50 / 92 / 134px

The Threads section is unaffected: its label still pins at 8px with parents at 36px directly beneath it. The scrollport strip was verified at 1280px in both themes — the child slice visible above the pinned row before the cap is gone after it. The partially clipped row below a pinned row remains: that is a row sliding under an opaque sticky row, i.e. ordinary sticky-list behavior.

Tests added that fail before and pass after:

  • BuiltInSidebarSection.test.tsx asserts the sticky group reports data-sidebar-sticky-header="false" for Pinned and omits the attribute for Threads.
  • theme.test.ts asserts the collapsed label slot for non-sticky headers, that the section-variant rule still chains off project-top, and that the cap is sticky, opaque, and offset by its own negative margin.

Commands:

  • pnpm exec turbo run typecheck lint test --filter=@bb/app → 544 test files, 4804 tests passing; no lint errors.
  • One run hit a failure in src/views/thread-detail/SplitThreadArea.archive.test.tsx (a routing assertion unrelated to these changes); it passed in isolation and on a forced full re-run, so it appears flaky.

AGENT GENERATED

ymichael and others added 2 commits September 17, 2026 11:04
The sidebar sticky stack derives every tier offset from
--bb-sidebar-sticky-project-top, which reserves the section label's
height and gap. Pinned renders its label in normal flow
(stickyHeader={false}), so the reserved slot stayed empty and its
project and parent rows pinned a label-height too low.

Mark the section group with data-sidebar-sticky-header="false" and
collapse --bb-sidebar-sticky-project-top to the stack's top padding for
those groups, correcting the project tier and every parent level from one
override.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The sticky stack's top padding sits inside the scrollport, so rows stay
visible while they scroll through it. A sticky section label hides that
strip behind its own opaque top shield, and every other tier used to pin
below a sticky label, so nothing else needed one. Collapsing the label
slot for non-sticky headers moved Pinned's parent rows flush against the
strip, and the child scrolling underneath showed through it above the
pinned row.

Give the stack one sticky cap of its own top padding, pulled over the
strip with a negative top margin so layout is unchanged and it is
invisible at rest.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@ymichael
ymichael merged commit 65344c2 into main Sep 17, 2026
16 checks passed
@ymichael
ymichael deleted the bb/fix-sidebar-discord-row-scrolling-thr_yatghhu7cu branch September 17, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant