diff --git a/CHANGELOG.md b/CHANGELOG.md index d84867359d8..12500a307e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Fixed the `img` element in `EuiIcon` using custom SVGs to have an `alt` attribute with an empty string, rather than no `alt` attribute at all ([#3245](https://github.com/elastic/eui/pull/3245)) - Added overflows to EuiDataGrid toolbar dropdowns when there are many columns ([#3238](https://github.com/elastic/eui/pull/3238)) - Fixed `EuiIcon`'s icon `type` definition to allow custom React components ([#3252](https://github.com/elastic/eui/pull/3252)) +- Fixed `initialSelectedTab` properties used in `EuiDatePopoverContent` ([#3254](https://github.com/elastic/eui/pull/3254)) ## [`22.3.0`](https://github.com/elastic/eui/tree/v22.3.0) diff --git a/src/components/date_picker/super_date_picker/date_popover/date_popover_content.js b/src/components/date_picker/super_date_picker/date_popover/date_popover_content.js index 58d120dad36..333bc2071af 100644 --- a/src/components/date_picker/super_date_picker/date_popover/date_popover_content.js +++ b/src/components/date_picker/super_date_picker/date_popover/date_popover_content.js @@ -37,75 +37,76 @@ export function EuiDatePopoverContent({ const ariaLabel = `${position === 'start' ? 'Start' : 'End'} date:`; - const renderTabs = () => { - return [ - { - id: DATE_MODES.ABSOLUTE, - name: 'Absolute', - content: ( - - ), - 'data-test-subj': 'superDatePickerAbsoluteTab', - 'aria-label': `${ariaLabel} Absolute`, - }, - { - id: DATE_MODES.RELATIVE, - name: 'Relative', - content: ( - - ), - 'data-test-subj': 'superDatePickerRelativeTab', - 'aria-label': `${ariaLabel} Relative`, - }, - { - id: DATE_MODES.NOW, - name: 'Now', - content: ( - + ), + 'data-test-subj': 'superDatePickerAbsoluteTab', + 'aria-label': `${ariaLabel} Absolute`, + }, + { + id: DATE_MODES.RELATIVE, + name: 'Relative', + content: ( + + ), + 'data-test-subj': 'superDatePickerRelativeTab', + 'aria-label': `${ariaLabel} Relative`, + }, + { + id: DATE_MODES.NOW, + name: 'Now', + content: ( + +

+ Setting the time to "now" means that on every refresh this + time will be set to the time of the refresh. +

+ onChange('now')} + fullWidth size="s" - color="subdued" - className="euiDatePopoverContent__padded--large"> -

- Setting the time to "now" means that on every refresh - this time will be set to the time of the refresh. -

- onChange('now')} - fullWidth - size="s" - fill> - Set {position} date and time to now - -
- ), - 'data-test-subj': 'superDatePickerNowTab', - 'aria-label': `${ariaLabel} Now`, - }, - ]; - }; + fill> + Set {position} date and time to now + +
+ ), + 'data-test-subj': 'superDatePickerNowTab', + 'aria-label': `${ariaLabel} Now`, + }, + ]; + + const initialSelectedTab = () => + renderTabs.filter(tabs => tabs.id === getDateMode(value))[0]; return (