Repository navigation
fix(platform): scroll a task's thread by trackpad in the board dialog - #4863
Merged
Merged
Conversation
The board's task dialog locks the page's scroll, and the lock cancels an upward wheel or touch unless the scrollport under it has room above: it reads `scrollTop` above 0 as room. The thread column was a `column-reverse` scrollport, which rests at `scrollTop` 0 and scrolls into negative offsets, so every upward gesture over the thread was cancelled. The lock only intercepts wheel and touch events, so a trackpad could not scroll the open task at all. The column is an ordinary scrollport now, held on its newest end by `useThreadScroll`: it opens there, follows the thread and its own box while the reader is at the end, and leaves a reader who scrolled up where they are. Safari has no scroll anchoring, which the reversed scrollport made unnecessary by growing upward, so there the hook also moves the scrollport by how far a row above the reader changed height (a row skipped by `content-visibility` is drawn at its real height as it nears). It stands down while a history load holds the place itself. Tests drive a real wheel in a dialog hosted like the board's, and the column's follow, hold and place-holding rules, in real Chromium. The history tests now read the conversation in the real column.
A resize observer runs after a frame's animation callbacks, so a test that waited one frame and then asserted the thread had held still read before the column's own observer had its turn, and would have passed whatever the column did. The tests now wait for two frames, as the conversation's tests already do. Two more cases cover the rule that a reader within a few lines of the end follows the thread again, and that one a screen above it is left where they are. Breaking each rule of `useThreadScroll` in turn turns a test red.
The rows of a task's conversation skip layout and paint until they near the viewport, and keep the height they last had. A row drawn for the first time rarely has the height that was guessed for it, and everything under it moves. Chromium and Firefox anchor scrolling and hold what the reader is reading still; Safari does not, so every such row was a jump, and the thread moved the scrollport by script while a flick was under way, which on a touch screen can cut the flick. The rows now skip layout only where `overflow-anchor` is supported, from one definition in `lib/lazy-layout.ts` instead of three spellings. In Safari every row is laid out in full: relaying out a 61-row thread took about 5 ms there against 1 ms with rows skipped. The thread no longer needs to move the scrollport as rows near the reader, only when something above them really changes, such as an image arriving. Opening the page in WebKit also lands on the end in one step; with the rows' first guess it painted a frame of mid-thread first.
The thread took any scroll event that did not move up, within 48px of the end, for the reader coming back to it. Two things produce such events without the reader: the browser anchoring when a row above grows, and the column's own correction. A reader who had scrolled up a few lines was pulled back to the end by the next arrival. A reader's scroll moves the offset and the distance to the end in opposite directions, up and farther or down and nearer. Anchoring and the column's correction move the offset and the end together and leave the distance alone, and a browser giving back an offset it had clamped moves it toward the end while the thread has grown, so the distance grows too. Leaving and rejoining the end now need both signals, and an event for an offset already looked at is ignored. Reading the distance alone was tried first and took the restored offset for a reader scrolling away. New tests cover a reader nudged up a few lines while a row above grows (both where the browser anchors and in Safari's way), the scrollport growing under a reader at the end, a scroll event its own pin queued arriving after more thread did, and the Safari path beside the real history load. Tests that wait out a wheel now wait for the scrollport to stop moving, and the one that asserts nothing moved reads a row that is in view.
On a task with more than a page of comments, a new comment drops the oldest row off the top as it joins the end. The browser anchors the row that left and moves the offset by its height, a scroll event that looks exactly like a reader scrolling up, and the thread stopped following: posting a comment on a long task left the end 80px out of view, with the new comment partly below the fold. Where the thread's height happens to net out the offset change is the only thing in the event, so no reading of the offset and the height can tell the two apart. Native anchoring is now switched off on the scrollport while the thread follows the end, which the thread pins itself, and on while the reader reads, when it holds their place. A class carries the switch so it never fights the history load's inline one. Without anchoring while following, the only scroll events are the reader's, the thread's own, and a clamp that lands on the end. An input-timing rule was tried first and dropped: a scroll that comes with a wheel, a key, a touch or a press counts as the reader's. It could not separate the anchoring event from a reader's scroll in a frame where the thread also changed size, and it would have let find-in-page or a screen reader be pulled back to the end. New tests cover a new comment dropping the oldest row (both where the browser anchors and in Safari's way), a reader who scrolls up while the last row keeps growing, the anchoring switch itself, and a scroll toward the end that arrives with more thread. Breaking each of eleven rules of the hook in turn turns a test red.
yannickmonney
added this pull request to the merge queue
Oct 12, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 12, 2026
yannickmonney
added this pull request to the merge queue
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4792.
Cause
The board's task dialog is a modal Radix dialog, and its scroll lock (
react-remove-scroll) cancels an upward wheel or touch unless the scrollport under the pointer has room above: it readsscrollTop > 0as room. The thread column was acolumn-reversescrollport, which rests atscrollTop0 and scrolls into negative offsets, so every upward gesture over the open task was cancelled. The lock only intercepts wheel and touch events, so the keyboard and the scrollbar still moved the thread — hence "with a trackpad" (macOS hides overlay scrollbars). It was the onlycolumn-reversescrollport in the app.Reproduced on the board's dialog in Chromium and in Playwright's WebKit: a wheel of -300 left the thread where it was (in Chromium the event reached
windowalready cancelled,defaultPrevented: true). The same wheel on the standalone task page scrolled the thread (checked in Chromium).Fix
TaskThreadColumnis an ordinary scrollport now, held on its newest end by a newuseThreadScrollhook:HELD_SCROLLPORTS, besideuseTaskHistoryAnchor).The conversation's rows skip layout (
content-visibility) only where the browser anchors scrolling, from one definition inlib/lazy-layout.tsinstead of three spellings. A row drawn for the first time rarely has the height that was guessed for it and everything under it moves; Chromium and Firefox hold the reader still, and Safari showed every such row as a jump (34 of 60 wheel notches in WebKit with a plain ordinary scrollport). Making the thread correct that by script would have writtenscrollTopas rows near the reader, which on a touch screen can cut a flick. In Safari every row is laid out in full instead: relaying out a 61-row thread took about 5 ms in WebKit against 1 ms with rows skipped, and longer histories scale with the rows loaded.The reversed scrollport had a Safari jump of its own, which this also removes: a comment arriving at the end while you read above moved the row being read by 224px in WebKit with the old column, and by 0 with the new one (0 in Chromium with both).
I did not use
use-stick-to-bottom: it follows the content only (not the scrollport's own box), animates by default and registers document listeners when imported, and does not hold a reader's place in Safari.Verified
oxlint,oxfmt,tsc,knip,lint:manualandcheck-guideon the tasks suite; the tasks browser suite (119 tests) and the tasks, projects, home, routes and chat jsdom suites (2008 tests).TASK-F92, and an automation row for what the browser specs own.Not covered
scrollTopwhen something above the reader really changes height, which on a touch device may cut a flick; I could not measure that, andTASK-F92asks for an iPhone and an iPad flick. The reversed column needed no script for upward scrolling there. Firefox did not run (the installed Playwright build did not match).