Repository navigation
[EuiDatePicker] Prevent onChange from firing out-of-bounds dates on month/year navigation - #9685
Conversation
…onth/year navigation
onChange from firing out-of-bounds dates on month/year navigation
💚 Build Succeeded
History
cc @acstll |
💚 Build SucceededHistory
cc @acstll |
|
Posting on behalf of Claude (claude-sonnet-4-6 via Claude Code). Ran a Kibana CI check against this PR using build #449512 on PR elastic/kibana#271668. The build finished with 2 test failures, neither related to the EUI changes here:
Both are unrelated UI timing flakes in Kibana's FTR suite. The date picker fix in this PR is safe from a Kibana CI perspective. |
There was a problem hiding this comment.
Pull request overview
Fixes a bug in EuiDatePicker where selecting an out-of-bounds month/year from the dropdown navigation fired onChange with an invalid date due to a "rejection notification" branch in the underlying react-datepicker fork's setSelected method.
Changes:
- Removed the
onChange/onSelectcalls in the out-of-bounds branch ofsetSelectedin the vendored react-datepicker. - Added Jest tests for month and year dropdown navigation with
minDate/maxDate. - Added changelog entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/eui/src/components/date_picker/react-datepicker/src/index.js | Removes the spurious onChange/onSelect calls for out-of-bounds dates |
| packages/eui/src/components/date_picker/date_picker.test.tsx | Adds tests covering month and year dropdown navigation with bounds |
| packages/eui/changelogs/upcoming/9685.md | Adds changelog entry for the fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
weronikaolejniczak
left a comment
There was a problem hiding this comment.
LGTM 🟢 Thanks for the fix, Arturo!
## Dependency updates `@elastic/eui` - v116.2.0 ⏩ v116.3.1 `@elastic/eslint-plugin-eui` - v2.13.0 ⏩ v2.14.0 ## Package updates ### `@elastic/eui` [v116.3.1](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md) **Bug fixes** - Fixed `EuiTableHeaderCell` and `EuiTableHeaderCellCheckbox` throwing an error in Jest test environments due to static mocking of `useGeneratedHtmlId` by generating a stable, unique key with `uuidv4` ([#9698](elastic/eui#9698)) - Fixed an issue where the tooltip anchor wrapper in `EuiAvatar` did not have the same `border-radius` applied as the avatar itself. ([#9697](elastic/eui#9697)) ### `@elastic/eui` [v116.3.0](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md) - Added `EuiBanner` component ([#9673](elastic/eui#9673)) - Replaced native browser `title` attributes with `EuiToolTip` across the following components for consistent tooltips: ([#9643](elastic/eui#9643)) - `EuiAvatar` - `EuiBasicTable` - `EuiBreadcrumbs` - `EuiComboBox` - `EuiDataGrid` - `EuiAutoRefresh` - `EuiSuperDatePicker` - `EuiFieldPassword` - `EuiMarkdownEditor` - `EuiPagination` - `EuiSearchBar` - `EuiSelectable` - `EuiTextTruncate` - Extended `EuiToolTip`'s `display` prop to support `"flex"` ([#9643](elastic/eui#9643)) - Added experimental support for sticky headers in `EuiTable`, `EuiBasicTable` and `EuiInMemoryTable` ([#9682](elastic/eui#9682)) **Bug fixes** - Fixed `direction="row"` not applying on `EuiSplitPanel.Outer` when `onClick` was set. ([#9693](elastic/eui#9693)) - Fixed `EuiDatePicker` firing `onChange` with an out-of-bounds date when navigating to a month or year via the dropdowns while `minDate` or `maxDate` is set ([#9685](elastic/eui#9685)) - Fixed a visual issue on `EuiPanel` where panels with `onClick` would render with a `height` difference of `1px`. ([#9694](elastic/eui#9694)) - Fixed an issue in `EuiSelectable` and `EuiComboBox` where interactive content in group labels wasn't clickable due to overlapping content. ([#9678](elastic/eui#9678)) ### `@elastic/eslint-plugin-eui` [v2.14.0](https://github.com/elastic/eui/blob/main/packages/eslint-plugin/changelogs/CHANGELOG_2026.md) - Removed auto-fix from `tooltip-button-icon-wrap` rule ([#9695](elastic/eui#9695)) --------- Co-authored-by: Tomasz Kajtoch <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Lene Gadewoll <[email protected]>
## Dependency updates `@elastic/eui` - v116.2.0 ⏩ v116.3.1 `@elastic/eslint-plugin-eui` - v2.13.0 ⏩ v2.14.0 ## Package updates ### `@elastic/eui` [v116.3.1](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md) **Bug fixes** - Fixed `EuiTableHeaderCell` and `EuiTableHeaderCellCheckbox` throwing an error in Jest test environments due to static mocking of `useGeneratedHtmlId` by generating a stable, unique key with `uuidv4` ([elastic#9698](elastic/eui#9698)) - Fixed an issue where the tooltip anchor wrapper in `EuiAvatar` did not have the same `border-radius` applied as the avatar itself. ([elastic#9697](elastic/eui#9697)) ### `@elastic/eui` [v116.3.0](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md) - Added `EuiBanner` component ([elastic#9673](elastic/eui#9673)) - Replaced native browser `title` attributes with `EuiToolTip` across the following components for consistent tooltips: ([elastic#9643](elastic/eui#9643)) - `EuiAvatar` - `EuiBasicTable` - `EuiBreadcrumbs` - `EuiComboBox` - `EuiDataGrid` - `EuiAutoRefresh` - `EuiSuperDatePicker` - `EuiFieldPassword` - `EuiMarkdownEditor` - `EuiPagination` - `EuiSearchBar` - `EuiSelectable` - `EuiTextTruncate` - Extended `EuiToolTip`'s `display` prop to support `"flex"` ([elastic#9643](elastic/eui#9643)) - Added experimental support for sticky headers in `EuiTable`, `EuiBasicTable` and `EuiInMemoryTable` ([elastic#9682](elastic/eui#9682)) **Bug fixes** - Fixed `direction="row"` not applying on `EuiSplitPanel.Outer` when `onClick` was set. ([elastic#9693](elastic/eui#9693)) - Fixed `EuiDatePicker` firing `onChange` with an out-of-bounds date when navigating to a month or year via the dropdowns while `minDate` or `maxDate` is set ([elastic#9685](elastic/eui#9685)) - Fixed a visual issue on `EuiPanel` where panels with `onClick` would render with a `height` difference of `1px`. ([elastic#9694](elastic/eui#9694)) - Fixed an issue in `EuiSelectable` and `EuiComboBox` where interactive content in group labels wasn't clickable due to overlapping content. ([elastic#9678](elastic/eui#9678)) ### `@elastic/eslint-plugin-eui` [v2.14.0](https://github.com/elastic/eui/blob/main/packages/eslint-plugin/changelogs/CHANGELOG_2026.md) - Removed auto-fix from `tooltip-button-icon-wrap` rule ([elastic#9695](elastic/eui#9695)) --------- Co-authored-by: Tomasz Kajtoch <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Lene Gadewoll <[email protected]>
Summary
minDateormaxDateis set onEuiDatePicker, selecting an out-of-bounds month or year from the dropdown was incorrectly firingonChangewith an invalid date.setSelectedmethod had a branch that calledonChange(as a "rejection notification") whenever a disabled/out-of-bounds date was encountered. WithadjustDateOnChange: true(the EuiDatePicker default) andaccessibleModeenabled, month/year dropdown navigation routes throughsetSelected, triggering this branch.onChange/onSelectcalls from the out-of-bounds branch insetSelected. The calendar view still navigates correctly becausesetPreSelectionis called independently inupdateSelection. The selected value stays unchanged until the user explicitly clicks a valid day.API Changes
N/A
Screenshots
No visual change — behavior fix only.
Impact Assessment
What will break?May impact style overridesMay break functional or snapshot testsIf changes require substantial updates to KibanaImpact level: 🟢 Low — consumers relying on
onChangefiring with out-of-bounds dates as a rejection signal will no longer receive those calls. The known workaround of re-validating inonChangeremains unaffected.Release Readiness
Documentation:No docs change needed.Figma:No design change.Migration guide:Not a breaking change.Adoption plan:Bug fix.QA instructions for reviewer
EuiDatePickerstory in Storybook.maxDate={moment().endOf('month')}and anonChangethat logs the received date.maxDate.onChangeis not called and the selected value remains unchanged.minDate.onChangecorrectly.Checklist before marking Ready for Review
QA: Tested light/dark modes, high contrast, mobile, Chrome/Safari/Edge/Firefox, keyboard-only, screen readerQA: Tested docs changesAddedbreaking changelabelReviewer checklist