Send a double click as a double click while driving - #478
Open
kevin9327 wants to merge 1 commit into
Open
Conversation
Every press the live screen sent claimed to be the first click in its place. Chrome fires `dblclick` on the far page only when the second press says it is the second, so a person holding the wheel could not double-click at all. Measured against Chromium 151 through the shipped `startScreencast`, with the two press-release pairs the surface builds. As sent today the page logged `click detail=1 | click detail=1`, no `dblclick`, and double-clicking a word selected nothing. With the browser's own count it logged `click detail=1 | click detail=2 | DBLCLICK detail=2` and selected the word. `MouseEvent.detail` is the count the person's browser already worked out, to its own timing and distance rules, so it is sent rather than reconstructed. Floored at one on a press, because the computer refuses a press of zero for the reason its own comment gives, and `detail` is zero on an event a script dispatched.
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 9, 2026 23:31
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Take the wheel of a Bot's browser and double-click something — a row in a table, a node in a tree, a
word you want to replace. Nothing happens. The clicks land: the page highlights, the row takes focus.
It just never counts as a double click, and there is nothing on screen to say why. The way on is to
find the menu item that does the same thing, if there is one.
Why
Chrome fires
dblclickon the page only when the second press tells it that it is the second.Input.dispatchMouseEventcarries that asclickCount, and the live screen sent the same numberevery time:
So two presses in the same place were two first clicks. No
dblclickever reached the page andevent.detailwas always 1.Measured, not reasoned
Driven through the shipped
startScreencastagainst Chromium 151 (playwright-core 1.62.1's ownbuild), sending the two press-release pairs the surface builds for a double click, against a div
logging
clickanddblclickand a line of text to double-click on:The fix
MouseEvent.detailis how many times in a row that button has been pressed in the same place,worked out by the person's own browser to its own timing and distance rules. That is exactly what
clickCountmeans, so it is sent rather than reconstructed on the far side — a second implementationof double-click timing is the wrong thing for either end of this to be holding.
Floored at one on a press, because
screencast.tsrefuses a press of zero for the reason its owncomment gives — Chrome would see a move that happens to have a button set, and no click at all — and
detailis zero on an event a script dispatched rather than a person.screencast.tsalready forwardsmessage.clickCount ?? 1, so nothing on the computer changes.Tests
New:
app/tests/live-screen-mouse.test.tsx, 4 tests, on the harnesslive-screen-keyboard.test.tsxalready uses — a socket double, plus one frame delivered so thecanvas knows what size to map a click against.
origin/main(1c7bd92) with only the new file applied: 3 pass, 1 fail.The other three are the guard against over-correcting and pass before and after: an ordinary click is
still exactly one click with the same payload it always had, a press whose
detailis zero is stillsent as one click rather than none, and a move is still not a click.
bun test app/tests shared— 379 pass, 0 fail (375 onorigin/main; the four new ones are thewhole difference).
Also run, clean:
bunx biome checkon both files andbun run --filter app typecheck.Note on the changelog
A person driving a browser behaves differently afterwards, so there is an entry. It goes at the top
of
## Unreleased, the line every open PR touching the changelog inserts at, so it will conflictwith any other that lands first. Happy to rebase.