Repository navigation
EPBDS-16211: a date field mounts its calendar picker when it is needed - #227
Merged
Merged
Conversation
A closed rc-picker cost about as much as the rest of a 200-row period table: the same table with text fields in place of its 400 date fields mounted in about half the time. A date field now renders what rc-picker renders for a closed field, the same elements with the same attributes read from the same props, until it comes within 200 px of the viewport, a pointer comes over it, or it takes the focus. Then rc-picker takes its place: under a pointer at once, so that the press is rc-picker's own, and on a focus with the focus handed to it. Where there is no IntersectionObserver, as in jsdom and on the server, the picker mounts before the first paint, so jsdom tests see rc-picker as before. InputDate.stand-in.test.js compares the two renderings for a set of props. In Chromium, the 200-row period table mounts in 150 ms instead of 251.
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.
What
A closed rc-picker was the largest cost left in the heaviest document's mount. I profiled the 200-row period table's mount on an unminified build in Chromium.
A date field now renders a stand-in until it is needed: the element rc-picker renders for a closed field.
flushSync, so that the press that follows is rc-picker's own.autoFocus, so the focus moves to rc-picker's input, and the field'sonFocushears it once.defaultOpen).Measured
In Chromium
npm run test:perf --tarballon the packed master and on this branch: five interleaved rounds on an Apple M4. The 200-row period table's mount:What scrolling now costs
The work moves rather than goes: a scroll through the table mounts the pickers of the rows it passes.
Designs measured and dropped
Mounting on the first press, hover or focus only. I prototyped this first. The table mounted in 121 and 123 ms, but:
The viewport version passes every existing test unchanged.
Tests
InputDate.stand-in.test.js, new, 20 cases.sizeoff by one, 12 of these cases fail.InputDate.server.test.js, new. The server renders the stand-in, with the value in the configured format, and no warning.e2e/interactive-views.pw.js, two new cases, listed ine2e/view-coverage.js. An observer that never reports keeps every field a stand-in. Then a click opens the calendar, the field keeps the focus and a day picked is written. A focus hands the field the focus, and a date typed there is written.InputDate.tsxis covered fully, as its threshold requires.What a user may notice
Gates
All 22 gates and the manifest contract exit 0 on the code of HEAD, on Node 24.14.0.
test:coverageandtest:react16failed onview-browser-coverage.contract.test.js:e2e/view-coverage.jsdid not list the two new browser tests. It does now.test:react17lost a jest worker to SIGSEGV inDropzone.behavior.test.js. That is the Node 24 crash of Crash in V8 GC on v24.x and earlier nodejs/node#62393.CLAUDE.md.Tests.
🤖 Generated with Claude Code