Repository navigation
Fix lost keystrokes in DateRangePicker - #10709
Open
AkashNemade16 wants to merge 6 commits into
Open
AkashNemade16 wants to merge 6 commits into
AkashNemade16 wants to merge 6 commits into
Conversation
AkashNemade16
force-pushed
the
akashnemade16-preserve-date-input-across-same-event-bl
branch
from
October 3, 2026 06:01
0eabf86 to
e8945d6
Compare
The React Compiler doesn't allow reassigning the displayValue state variable inside setDisplayValue. Keep the latest value in a ref that the setter updates and a layout effect resyncs after each render, and read it in confirmPlaceholder so a blur in the same event as the keystroke that moved focus sees the segment that was just typed. Also hoist the SSR-safe useLayoutEffect from useVirtualizerState into a shared react-stately util.
AkashNemade16
force-pushed
the
akashnemade16-preserve-date-input-across-same-event-bl
branch
from
October 12, 2026 02:33
8b72f09 to
cb4680d
Compare
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.
Closes #10683
Preserve the last digit when typing a date moves focus to the next field. The issue's
zh-TWexamples currently produce August 1 instead of August 5, or September 3 instead of September 30.Typing the last digit of a segment moves focus synchronously. When the next segment is in the other field of a
DateRangePicker, the blur runsconfirmPlaceholder()in the same event with a staledisplayValue.useDateFieldStatenow keeps the latestdisplayValuein a ref. The setter updates it synchronously, soconfirmPlaceholderreads the latest edit during the same event. A regularuseEffectresyncs the ref after rendering, including controlled value changes. No layout effect is added to the date-field state, and Virtualizer remains unchanged.Regression tests cover automatic focus advancement, invalid-date clamping, controlled/uncontrolled edits, and clearing or replacing a controlled value during an unfinished edit. Existing docs and stories still apply. AI assistance: GitHub Copilot and OpenAI Codex.
✅ Pull Request Checklist:
📝 Test Instructions:
The regression coverage includes both fields, leading-zero and invalid days, controlled/uncontrolled edits, displayed and committed values, automatic focus advancement, and clearing or replacing the controlled value during an unfinished edit.
Node 24.15.0, Yarn 4.18.0; review fix at
8fbe96f2e.yarn test --maxWorkers=2 --watchman=falseyarn test:ssr --watchman=falseyarn lintyarn test:browser --project=chromium-desktop --project=webkit-desktop --maxWorkers=1 --no-file-parallelismValidation notes: the initial SSR attempt could not bind its local server inside the sandbox; a later run had one startup connection reset, and the complete retry passed. The all-browser run could not connect to Firefox. A full WebKit-only run with the final changes passed 137 tests, skipped 26, and failed the Modal opening test; DateRangePicker passed in that run. One comparison run against the unchanged PR head passed all 138 WebKit tests, so the browser failures remain unresolved rather than being classified as pre-existing. The unit run exited successfully with a worker teardown warning. No Chromatic or manual screen-reader/mobile checks were run.
With
locale="zh-TW", type20260805or20260931without tabbing. Expect August 5 or September 30 after focus advances. Repeat for the end field with a following focusable control inside the picker, and edit15to07.🧢 Your Project:
N/A - community bug fix.