Repository navigation
Studio: keep the composer still when switching chats in WebKit - #16076
Merged
Merged
Conversation
The dock's ResizeObserver could measure the message column before the gutter watcher shifted it, so with classic scroll bars the composer was padded 10px/40px and painted a scrollbar width left of centre for a frame or two. The dock now syncs the gutter before measuring, and the watcher attaches in a layout effect so a remounted viewport is shifted before the first paint.
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
shimmyshimmer
pushed a commit
to shimmyshimmer/unsloth-staging-4
that referenced
this pull request
Oct 30, 2026
shimmyshimmer
added a commit
that referenced
this pull request
Oct 30, 2026
…issal (#16077) ## What changed Closing a dropdown by clicking elsewhere no longer leaves text highlighted. Before, a quick second click selected a word, and a third selected a whole message or, in Settings, the entire dialog. This affected every dropdown, select and popover, on every page. ## Why The OS counts the press that closes a menu as click 1 of a click sequence. The menu swallows that press, so people click again, and the next quick clicks arrive with click count 2 and 3. The browser treats those as a double click (select word) and a triple click (select block). A capture-phase guard, installed once in `AppProvider` (`src/lib/dismiss-click-streak.ts`), notes when a left press lands outside an open Radix menu, listbox or popover. For the rest of that click sequence, each press selects as if the dismissing click had not counted: - click 2 places the caret - click 3 selects the word (`Intl.Segmenter`, since `Selection.modify` word steps differ by platform) - click 4 and later select the enclosing block The press that closes the menu is untouched, and so are text fields. Double and triple clicks select as usual when no menu was just closed, and a fast run of clicks still ends up selecting text. ## Verification - `npm run typecheck`, `npm run build`: clean. - `npm test`: 14,463 of 14,468 pass, 1 skipped. The 4 failures are in `hub-gguf-card-unified-budget.test.ts` and fail identically on `main`. - New `tests/dismiss-click-streak.test.ts`: - follow-ups after a dismissal select one step finer - the click-count to granularity mapping - word bounds from `Intl.Segmenter` - normal double and triple clicks still select - a new click sequence resets the guard - presses inside the menu and in text fields keep native selection - the guard installs once and removes its listeners - Playwright, WebKit and Chromium. Each case opens a menu, then sends a hand-paced click sequence (click count 1, 2, 3, about 180ms apart) onto nearby text: | Menu | Before (click 2 / click 3) | After (click 2 / click 3) | | --- | --- | --- | | Settings Theme | "Accent" / "Accent " | nothing / "Accent" | | Settings UI font | "Contrast" / "Contrast " | nothing / "Contrast" | | Composer "Approve for me" | "Lorem" / whole 347-char message | nothing / "Lorem" | | Account menu | "Lorem" / whole 347-char message | nothing / "Lorem" | - A fast run of 8 clicks after a dismissal selects the caret, the word, then the block, instead of nothing. - At 12 points across four words, the word and block selected after a dismissal match a native double and triple click in 47 of 48 cases. The exception is Chromium on the last 2px of a word's final letter, where native selects the following space. ## Also in this PR Comment-only trims to `thread.tsx`, `images-page.tsx` and `video-page.tsx`, carried over from #16076 and #16081, which merged before their final comment pass. ## Not covered Not tested in the Desktop app's native WebView or on touch input. The guard only acts on mouse click counts above 1.
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.
What changed
Switching chats no longer makes the composer jump sideways for a frame or two. This happened in WebKit (the macOS Desktop app, Safari) when classic scroll bars are showing, for example with a mouse connected.
Why
In WebKit, the thread viewport's
scrollbar-gutter: stable both-edgesreserves both gutters on the right, sowatchThreadGuttershifts the column back withdata-gutter-shift. The composer dock measures that column to set its side padding (--composer-dock-inset-*). When a scroll bar appears (for example, a chat's messages arrive after the switch), the dock's ResizeObserver could fire before the gutter watcher's. The dock then measured the unshifted column and padded the composer10px/40pxinstead of25px/25px. That put the composer one scroll bar width (about 15px) left of centre until the gutter caught up.syncThreadGutter(viewport)before it measures, so it always measures the shifted column.watchThreadGutterattaches in a layout effect instead of a passive one, so a viewport remounted by a thread switch is shifted before its first paint.Verification
npm run typecheck,npm run build: clean.npm test: 14,459 of 14,463 pass. The 4 failures are inhub-gguf-card-unified-budget.test.tsand fail identically onmain.tests/thread-gutter.test.ts:syncThreadGutterapplies the shift before the gutter's own observer fires, and the source asserts the layout-effect watcher and the sync-before-measure order. They fail onmain.10px/40pxand the composer to x=473 instead of 488. This happened on every run.Not covered
Headless WebKit corrects the bad padding before it paints, so the visible one-frame jump itself was only seen in a screen recording from the Desktop app, not reproduced here.