Harden mouse input routing contracts with deterministic coverage#69
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1197ed9331
ℹ️ 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".
| if (keybindingsEnabled) { | ||
| if ( | ||
| ev.kind === "mouse" && | ||
| (ev.mouseKind === 3 || ev.mouseKind === 4) && |
There was a problem hiding this comment.
Reset pending chord only on mouse-down
Including mouseKind === 4 here can cancel a chord that started after the click began: if a user presses and holds mouse, types the first key of a multi-key binding, then releases mouse, this branch clears pendingKeys on mouse-up and the next key no longer matches. The fix for stale pre-click chords only needs to clear on down (or otherwise distinguish up events that belong to a click that happened before the chord started).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in cb49e31.
Changes:
- Reset pending chord state only on
mouseKind === 3(mouse-down) increateApp. - Added regression test
mouse up does not clear chord started after mouse downinpackages/core/src/keybindings/__tests__/keybinding.conflicts.test.ts.
Validation:
npm -w @rezi-ui/core run buildnode --test --test-concurrency=1 packages/core/dist/keybindings/__tests__/keybinding.conflicts.test.jsnpm run lint
All pass.
Summary
mouseKinddown/up)packages/core/src/runtime/__tests__/mouse.click.test.ts(23 tests)packages/core/src/runtime/__tests__/mouse.scroll.test.ts(13 tests)packages/core/src/runtime/__tests__/mouse.drag.test.ts(16 tests)packages/core/src/runtime/__tests__/mouse.mixed.test.ts(14 tests)packages/core/src/keybindings/__tests__/keybinding.conflicts.test.tsdocs/guide/mouse-support.mddocs/guide/input-and-focus.mdWhy
This hardening pass pins existing mouse contracts (no feature expansion) and closes routing/test gaps so regressions in click activation, scroll clamping/routing, split-pane drag constraints, hit-testing precedence, and mouse+keyboard interaction are caught deterministically.
Validation
npm run buildnpm run typechecknpm run lintnode scripts/run-tests.mjsAll commands pass locally.
2254passed,0failed.