fix(web): submit event form with Mod+Enter from color swatch - #2563
Merged
Conversation
Pass ignoreInputs:false for Mod+Enter like other form hotkeys, and omit undefined options in useAppShortcut so TanStack Mod defaults survive re-renders after color selection. Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
Leave Mod+Enter submit to the global hotkey; local handleIgnoredKeys only preventDefaults, matching Mod+D. Adds a title-field once-submit regression and simplifies the Mod dispatch test helpers. Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
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
CMD/Ctrl+Enter did nothing when focus stayed on an event color radio after changing color.
Mod+Enterwas registered withoutignoreInputs: false, anduseAppShortcutpassedignoreInputs: undefinedinto TanStacksetOptions, which clobbered the Mod-key default (ignoreInputs: false) on re-render. Title/description still worked via a localonKeyDownpath that color radios never received.This registers
Mod+EnterwithEVENT_FORM_PLAIN_HOTKEY_OPTIONS(same asMod+D), omits undefined hotkey option keys so TanStack defaults survive re-renders, and stops the local field handler from also callingonSubmitFormso text fields submit exactly once.Simplicity
Minimal fix: reuse the existing form hotkey options constant, build
useHotkeyoptions without spreadingundefined, and align local Mod+Enter with Mod+D (preventDefault only). Test helpers merged to one Mod dispatch.Automated validation
useAppShortcutandEventForm(color-swatch Mod+Enter, title once-submit, Mod+radio after rerender): 41 passbun lint: clean for touched files (3 pre-existing warnings elsewhere)Independent review
Confirmed high finding fixed: dual Mod+Enter submit from text fields after enabling global ignoreInputs:false. Local handler now only preventDefaults; once-submit regression added. No other confirmed findings.
Test plan
bun test:web packages/web/src/shortcuts/useAppShortcut.test.ts packages/web/src/views/Forms/EventForm/EventForm.test.tsxbun lint