Repository navigation
fix(dashboard): let Enter activate buttons inside modal and drawer forms - #17438
Merged
Merged
Conversation
ðĶ Changeset detectedLatest commit: 266e662 The changes in this PR will be included in the next version bump. This PR includes changesets to release 83 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Author
|
Thanks for the contribution! Initial automated review looks good. Verdict: Looks good for a final review by the team. Extends Checked: security, performance, correctness, conventions, changeset, tests. Suggestions (non-blocking):
Triggered by: new PR opened |
shahednasser
approved these changes
Oct 23, 2026
Merged
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.
Summary
What â Pressing Enter on a focused button or link inside a
KeyboundFormnow activates it, the same as a click.Why â Most admin forms in
RouteFocusModalandRouteDrawerare wrapped inKeyboundForm. ItsonKeyDownhandler calledevent.preventDefault()on every Enter keydown unless the target was a textarea. Blocking implicit submission from inputs is intended. But the handler also cancelled the browser's native Enter activation on buttons and links. So keyboard users couldn't use Enter on the focus modal's header close button (e.g. the Create Customer modal), or on the drawer footer Cancel and Save buttons.How â
packages/admin/dashboard/src/components/utilities/keybound-form/keybound-form.tsxnow returns early forHTMLButtonElementandHTMLAnchorElementtargets, as it already did for textareas, unless Cmd/Ctrl is held. Enter in inputs still doesn't submit, and Cmd/Ctrl+Enter still submits from anywhere in the form.Testing â Added
src/components/utilities/keybound-form/__tests__/keybound-form.spec.ts. Before the fix, the button and link cases fail:preventDefaultwas called once when it shouldn't have been. After the fix they pass. The spec also covers the existing input and Cmd/Ctrl+Enter behavior. I also ran the full dashboard Vitest suite.Checklist
Additional Context
src/lib/__tests__/reload-on-preload-error.spec.tstimes out locally. That spec doesn't touchKeyboundForm, and the timeouts look environmental.Fixes #17172