Repository navigation
Studio: no text selection from the clicks that follow a dropdown dismissal - #16077
Conversation
…issal The OS counts the press that closes a menu as click 1, so the next quick clicks arrive as a double and triple click and select a word, then a whole block. A capture guard in AppProvider prevents the mousedown default for the rest of a click run that started by dismissing a Radix menu, listbox or popover.
|
@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". |
Blocking every press in the dismissing click run left text unselectable while clicks kept coming quickly. Each later press now selects as if the dismissing click had not counted: caret, then word, then paragraph.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be6a65effc
ℹ️ 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".
| } else if (streakFromDismiss && !target?.closest(TEXT_ENTRY)) { | ||
| event.preventDefault(); | ||
| select(event, target); |
There was a problem hiding this comment.
Preserve drag selection after dismissing a menu
If a user dismisses a menu over message text and immediately presses again and drags to select text, the second press has detail === 2 and enters this branch. Canceling mousedown prevents the browser from starting its native drag-selection gesture, while select() only sets a collapsed caret at the initial coordinates; there is no mouse-move handling to extend it. Consequently, users cannot select an arbitrary text range with that gesture until they pause long enough to reset the click count. Preserve drag selection while adjusting the initial selection granularity.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f0636f0: the shifted press now follows the drag and extends the selection by its unit (caret, word or block), matching a native drag in WebKit.
Cancelling that press also cancelled its native drag selection. The guard now follows the drag and extends the selection by the press's unit, as a native drag does.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0636f026b
ℹ️ 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".
| const onMouseMove = (event: MouseEvent): void => { | ||
| if (!extend) return; | ||
| if (event.buttons & 1) extend(event.clientX, event.clientY); | ||
| else extend = null; |
There was a problem hiding this comment.
Preserve edge autoscrolling during shifted drag selection
When a user dismisses a menu and immediately drags to select a message longer than the chat viewport, canceling mousedown disables the browser's native selection gesture, including edge autoscrolling. The replacement only updates selection coordinates on mousemove; it never scrolls the container or continues updating while the pointer is stationary at its edge. Consequently, this gesture cannot select text beyond the visible portion of the scrollable chat viewport. Add edge autoscrolling to the replacement drag behavior or preserve the native drag gesture.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: it needs a drag started within the double-click interval of a menu dismissal that also runs past the viewport edge. Any drag after that interval is native, autoscroll included, and a custom autoscroller for that window is more risk than the case warrants.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. 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". |
…#16082) `Frontend unit tests` is red on main. All four cases in `studio/frontend/tests/hub-gguf-card-unified-budget.test.ts` fail (seen on #16077's run): ``` not ok - the Hub GGUF card recommends a quant inside the Mac's Metal load budget error: 'no stub for import "@/lib/folder-icons" in .../src/features/hub/catalog/gguf-download-card.tsx' ``` #15958 moved the card's folder glyph to `@/lib/folder-icons` and added that stub to the other `loadWithStubs` tests. This test, from #15848 and merged the same day, was not in that sweep. The card is correct; the test's stub map was one module behind. This adds `"@/lib/folder-icons": anyExport` next to the other icon stubs. ## Verification - `node --test tests/hub-gguf-card-unified-budget.test.ts`: 4 failed on main, 4 passed here. - The full frontend suite on main fails only these four.
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:Intl.Segmenter, sinceSelection.modifyword steps differ by platform)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 inhub-gguf-card-unified-budget.test.tsand fail identically onmain.New
tests/dismiss-click-streak.test.ts:Intl.SegmenterPlaywright, 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:
Also in this PR
Comment-only trims to
thread.tsx,images-page.tsxandvideo-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.