fix(web): focus current time for picker arrow keys - #2769
Draft
tyler-dane wants to merge 1 commit into
Draft
Conversation
react-select opens the menu with reference equality, so a separately constructed value left keyboard focus on 12:00 AM. Resolve to the matching option (or insert custom times) so Up/Down move one interval. 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
Keyboard Up/Down on the event start/end time pickers jumped to early-morning times (e.g. 12:15 AM) instead of moving one 15-minute interval from the current value (e.g. 5:30 PM → 5:15 PM).
Cause: react-select focuses the selected option with reference equality (
options.indexOf(value)). Compass passes a separately constructed{ label, value }object, so focus fell back to the first option while visual scroll still showed the selected time.Fix: Resolve the select
valueto the matching object fromoptionsbefore rendering. Custom (typed) times are inserted into the menu list in chronological order so they remain focusable too.Test plan
bun run test:web -- packages/web/src/views/Forms/EventForm/DateControlsSection/DateTimeSection/TimePicker/bun run lint(no new issues)