Skip to content

Tap the mobile header to scroll to top - #4742

Merged
brsbl merged 5 commits into
mainfrom
bb/tap-the-mobile-header-to-scroll-to-top-thr_stv78thfm7
Oct 2, 2026
Merged

brsbl merged 5 commits into
mainfrom
bb/tap-the-mobile-header-to-scroll-to-top-thr_stv78thfm7

Conversation

@brsbl

@brsbl brsbl commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The mobile header had no scroll-to-top action, so returning to the start of a long thread required manual scrolling.

What changed

  • Tap the mobile header background or plain title to scroll smoothly to the top.
  • Header controls retain their actions, and reduced-motion settings skip the animation.
  • Thread views stay detached through the animation so content growth does not pull readers back down.

How you verified

  • Chrome for Testing 151.0.7922.71, 390×844: header tapping moved scrollTop from 596 to 0.
  • A 300px viewport-growth fixture during smooth scrolling still ended at 0; manual scrolling remained available.
  • The regression failed before the fix: it incorrectly persisted atBottom: true.

Final-head remote CI: all three app test shards and checks passed, including the extended regression. All required jobs passed except host-package tests, which failed with the same Pi provider-parity timeouts reproduced on the main base.

Post-merge CI on 8a9f2816d4046bee5e488dbf88e36a69db271d31 passed every job except the same Pi provider-parity tests. The demo deployment passed.

Slop Cop found one P1, now fixed, and two P2 follow-ups retained under the review policy:

  • Register Plugins/Skills collection and detail scrollers so their mobile headers also return to the top.
  • Ignore portaled menu-backdrop clicks in the header handler so dismissing a menu preserves the reading position.

Before: 4acc7fa · After: f7ada4a · Captured at 2×

Screen / state Viewport Before After
Thread after tapping the top of the header Mobile · 390×844 Before: header tap keeps the thread scrolled down After: header tap reveals the first message
header-scroll-growth.webm

BB-Thread-ID: thr_stv78thfm7

AGENT GENERATED

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T15:59:51.515360Z 6373220 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 637322006a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +6 to +8
const viewport = Array.from(
scope.querySelectorAll<HTMLElement>("[data-page-scroll-viewport]"),
).find((element) => element.getClientRects().length > 0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Register the tools scroll viewports

On compact /plugins and /skills routes, AppLayout renders this tappable AppPageHeader, but their actual scrollers are the unmarked ResourceScrollPage viewport (apps/app/src/views/ToolsView.tsx:120) and the inner ScrollArea used by ResourceCollectionViewport (packages/shared-ui/src/components/ui/resource/collection.tsx:158). Because neither has data-page-scroll-viewport, this query finds nothing and tapping the header is a no-op across those tools pages; register those actual viewports, including the collection viewport, so the feature applies consistently.

Useful? React with 👍 / 👎.

@brsbl
brsbl merged commit 8a9f281 into main Oct 2, 2026
26 of 27 checks passed
@brsbl
brsbl deleted the bb/tap-the-mobile-header-to-scroll-to-top-thr_stv78thfm7 branch October 2, 2026 16:48
ymichael added a commit that referenced this pull request Oct 25, 2026
## Human comments

## What was wrong

On compact viewports, `AppPageHeader` scrolls the page to the top when
its background is tapped (#4742). The thread actions menu renders its
drawer through a portal, but React bubbles synthetic events through the
component tree, not the DOM tree. A tap on the drawer's backdrop (or its
grab handle) therefore reached the header's `onClick`. The target was a
plain `div`, so it passed the interactive-element filter, and closing
the drawer smooth-scrolled the timeline to the top. #4742 listed this as
a deferred follow-up ("Ignore portaled menu-backdrop clicks in the
header handler").

## What changed

- `apps/app/src/components/layout/AppPageHeader.tsx`: the compact
tap-to-top handler ignores clicks whose target is outside the header's
DOM (`!event.currentTarget.contains(event.target)`). Taps on the header
itself behave as before.
- `apps/app/src/components/layout/AppPageHeader.test.tsx`: covers a
header tap (scrolls to top) and a click from a portaled child (does
not).

## How you verified

- Reproduced on an Android emulator (Pixel 9, Chrome) against the live
app with a scroll-write probe. Tapping the backdrop logged
`viewport.scrollTo({ top: 0, behavior: "smooth" })` from the
`PAGE_SCROLL_TO_TOP_EVENT` handler, called from React's click dispatch.
- Headless Chrome at 390×844: open the drawer at scrollTop 6000, then
click the backdrop. Main moves the timeline; this branch stays at 6000.
Re-checked on a `pnpm start:worktree` server for this branch: the
backdrop keeps the position, and the header "Scroll to top" button still
scrolls.
- The new test's portal case fails without the fix and passes with it.
- `pnpm exec turbo run typecheck --filter=@bb/app` and `pnpm exec turbo
run lint --filter=@bb/app` pass.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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