Repository navigation
fix(forms): use keydown for button active state - #573
Open
cursor[bot] wants to merge 1 commit into
Open
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
The active state listened for the deprecated keypress event. This listens for keydown instead. In Chromium 156, preventDefault on either event cancels space scrolling, and the active state and keyup click stay the same. Co-authored-by: crylan <crylan@nvidia.com> Signed-off-by: Cursor Agent <cursoragent@cursor.com>
cursor
Bot
force-pushed
the
topic/web-modernization/keydown-active-state
branch
from
November 15, 2026 03:51
85e0932 to
61d9a98
Compare
This branch has not been deployed
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.
Button active state listened for the deprecated
keypressevent. In the repository-pinned Chromium, preventing default onkeypressdoes not cancel the space-bar scroll that already starts onkeydown.StateActiveControllernow useskeydown, which keeps the active state and stops that scroll.Removed mechanism
projects/forms/src/internal/controllers/state-active.controller.tsadded and removed akeypresslistener for keyboard activation. That listener is nowkeydown.Native replacement and benefit
keydownis the event that carries the space-bar scroll default action. CallingpreventDefault()there cancels the scroll. The same call onkeypressis too late.Measured in Playwright 1.64.1, Chromium revision 1248, runtime
156.0.8078.4, on 2026-11-14 (viewport 600×300, page height 2000px, focusable host, Space held about 80ms):preventDefault:scrollTop142preventDefaultonkeypress:scrollTop72preventDefaultonkeydown:scrollTop0, and the followingkeypressis suppressedCompatibility sources
Element: keypressevent (deprecated; usebeforeinputorkeydown)keypresskeypress_event(api.Element.keypress_event)keypressfor known keyboard shortcuts; usekeydownPrimary support remains Chrome, per
projects/site/src/docs/about/support.md. Firefox and Safari both implementkeydown. Firefox has not firedkeypressfor most non-printable keys since version 65 (Enter is the exception). No public entrypoint changes. The empty@nvidia-elements/core/polyfillsexport stays published.Preserved behavior
:state(active)untilkeyup,blur, ormouseup.preventDefaulted. Space on the host is, including when the control is disabled.keyupinTypeSubmitController.click.defaultPreventedonkeydowndoes not cancel those clicks.Validation
156.0.8078.4) scroll probe, 2026-11-14projects/forms: Prettier check,pnpm run lint,pnpm run test:types, and the unit suite (23 files, 298 tests), including a real Space and Enter active-state testmise exec -- pnpm run ci: exit 0