[EuiDatePicker] Remove legacy string refs from react-datepicker dropdowns - #9960
Open
ChrisJamesC wants to merge 1 commit into
Open
[EuiDatePicker] Remove legacy string refs from react-datepicker dropdowns#9960ChrisJamesC wants to merge 1 commit into
ChrisJamesC wants to merge 1 commit into
Conversation
|
👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually? |
ChrisJamesC
added a commit
to ChrisJamesC/eui
that referenced
this pull request
Aug 27, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…owns React 19 removed support for legacy string refs. Rendering the month, year, or month-year dropdown therefore throws "Expected ref to be a function, an object returned by React.createRef(), or undefined/null" and unmounts the surrounding tree, making EuiDatePicker unusable on React 19 whenever showMonthDropdown / showYearDropdown is enabled. The `ref="options"` props are dead code: `this.refs` is not read anywhere in packages/eui/src, so removing them is behaviour-preserving. Existing date_picker snapshots are unchanged. Fixes elastic#9009 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ChrisJamesC
force-pushed
the
fix/react19-datepicker-string-refs
branch
from
August 27, 2026 10:22
bd1259b to
24fee02
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.
Summary
What: Removes three legacy string refs (
ref="options") from the vendoredreact-datepickerdropdown components.Why: Fixes #9009. On React 19, opening the month, year, or month/year dropdown throws during render:
React 19 removed legacy string refs. Because the throw happens in
markRefduringupdateClassComponent, React unmounts the whole tree — so this takes down the consuming application, not just the date picker.How: The offending props are in
packages/eui/src/components/date_picker/react-datepicker/src/:month_dropdown.js<MonthDropdownOptions ref="options">year_dropdown.js<YearDropdownOptions ref="options">month_year_dropdown.js<MonthYearDropdownOptions ref="options">All three are dead code rather than something needing migration to callback refs —
this.refsis not read anywhere in the package:They appear to be residue from the upstream fork in #5339. Deleting them is therefore behaviour-preserving, which is why this is a deletion rather than a
useRef/callback-ref migration.Worth noting for reviewers: these files match an ESLint ignore pattern, so
react/no-string-refsnever had a chance to flag them. That's likely why they survived this long.API Changes
None — no public prop, type, or token changes.
Screenshots
Not applicable — no visual change. On React 16–18 the rendered output is byte-identical (all 42 existing date_picker snapshots pass unmodified). On React 19 the difference is "throws" vs. "works", which isn't meaningfully screenshottable.
Impact Assessment
Impact level: 🟢 None
Release Readiness
Documentation— no documented behaviour changes.Figma— no design changes.Migration guide— no breaking or visual changes.Adoption plan— bug fix, not a new feature.QA instructions for reviewer
On React 16–18 (current supported range), this should be a no-op:
dropdownMode="scroll", the default).dropdownMode="select"is unaffected.EuiSuperDatePicker's absolute tab still works.To verify the actual fix, a React 19 environment is required: render
<EuiDatePicker showMonthDropdown showYearDropdown />and open either dropdown. Before this change it throws; after, it behaves normally.Checklist before marking Ready for Review
Filled out all sections above
QA: Tested light/dark modes, high contrast, mobile, Chrome/Safari/Edge/Firefox, keyboard-only, screen reader — not done; deletion of an unread ref with no rendered-output change
QA: Tested in CodeSandbox and Kibana — not done, happy to if the team wants it
QA: Tested docs changes— no docs changesTests:
yarn test-unit src/components/date_picker— 18/18 suites, 188 passed, 1 skipped, 42 snapshots unchangedNo new regression test: EUI's Jest environment runs React 18, where string refs still work, so the failure this fixes cannot be reproduced in the current test setup. A meaningful regression test depends on the React 19 test environment tracked in [Epic] React 19 support #8720.
Changelog: Added
Breaking changes: Added— not applicablebreaking changelabelScope note: this does not make EUI React 19 compatible overall (#8720, #7774). It removes one hard crash.
EuiFieldSearch(#9587) is still open, and the<StrictMode>work in #7774 is unaffected by this change.