Skip to content

fix: submit inputs on Enter without double-trigger#442

Closed
shields wants to merge 4 commits intoNerivec:mainfrom
shields:press-enter
Closed

fix: submit inputs on Enter without double-trigger#442
shields wants to merge 4 commits intoNerivec:mainfrom
shields:press-enter

Conversation

@shields
Copy link
Copy Markdown

@shields shields commented Feb 22, 2026

Add onKeyDown handlers to RangeEditor and TextEditor so pressing Enter triggers onChange. Track the last submitted value via a useTrackedValue hook to prevent double-trigger on Enter+blur and skip unnecessary blur submissions when the value hasn't changed.

Previously, RangeEditor and TextEditor only submitted values on blur
(clicking outside). Add onKeyDown handlers so pressing Enter also
triggers the onChange callback.
@Nerivec
Copy link
Copy Markdown
Owner

Nerivec commented Feb 22, 2026

Unless I'm mistaken, this will double-trigger with onBlur (enter then blur = 2x calls).

Track last submitted value with useTrackedValue hook so onChange is
only called when the value actually changed. Prevents double-trigger
when Enter is followed by blur, and skips unnecessary blur submissions
when the value hasn't changed.
@shields shields changed the title fix: submit numeric and text inputs on Enter key press fix: submit inputs on Enter without double-trigger Feb 22, 2026
@shields
Copy link
Copy Markdown
Author

shields commented Feb 22, 2026

Unless I'm mistaken, this will double-trigger with onBlur (enter then blur = 2x calls).

Good catch. There's a related bug in the current code in that if you focus and blur the field, it will submit unnecessarily. Fixed both issues.

@Nerivec
Copy link
Copy Markdown
Owner

Nerivec commented Feb 22, 2026

There's a related bug

Been meaning to fix that one indeed 😁
Let's wait for #443 to be merged (will likely conflict otherwise), then we can rebase this, and fix the bunch of other places where this bug also occurs.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions Bot added the Stale label Apr 23, 2026
@github-actions github-actions Bot closed this Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants