diff --git a/packages/shared-ux/button_toolbar/src/buttons/toolbar_button/toolbar_button.test.tsx b/packages/shared-ux/button_toolbar/src/buttons/toolbar_button/toolbar_button.test.tsx index 6761f4272079d1..b8cc7bdac2bdd2 100644 --- a/packages/shared-ux/button_toolbar/src/buttons/toolbar_button/toolbar_button.test.tsx +++ b/packages/shared-ux/button_toolbar/src/buttons/toolbar_button/toolbar_button.test.tsx @@ -45,6 +45,13 @@ describe('', () => { component.find('button').simulate('click'); expect(mockHandler).toHaveBeenCalled(); }); + + test('accepts an onBlur handler', () => { + const mockHandler = jest.fn(); + const component = mountWithIntl(); + component.find('button').simulate('blur'); + expect(mockHandler).toHaveBeenCalled(); + }); }); describe('iconButton', () => { diff --git a/packages/shared-ux/button_toolbar/src/buttons/toolbar_button/toolbar_button.tsx b/packages/shared-ux/button_toolbar/src/buttons/toolbar_button/toolbar_button.tsx index 1e005d110e6cf3..a120c3184ff201 100644 --- a/packages/shared-ux/button_toolbar/src/buttons/toolbar_button/toolbar_button.tsx +++ b/packages/shared-ux/button_toolbar/src/buttons/toolbar_button/toolbar_button.tsx @@ -23,7 +23,7 @@ type ButtonRenderStyle = 'standard' | 'iconButton'; interface ToolbarButtonCommonProps extends Pick< EuiButtonPropsForButton, - 'onClick' | 'iconType' | 'size' | 'data-test-subj' | 'isDisabled' | 'aria-label' + 'onClick' | 'onBlur' | 'iconType' | 'size' | 'data-test-subj' | 'isDisabled' | 'aria-label' > { /** * Render style of the toolbar button diff --git a/src/core/public/styles/_base.scss b/src/core/public/styles/_base.scss index 4cc9c48c726661..22d461a8b4084d 100644 --- a/src/core/public/styles/_base.scss +++ b/src/core/public/styles/_base.scss @@ -9,7 +9,11 @@ // focus states in Kibana. :focus { &:not([class^='eui']):not(.kbn-resetFocusState) { - @include euiFocusRing; + // The focus policy causes double focus rings to appear on EuiSelectableList + // since the focusable element does not contain a class starting with "eui". + &:not(.euiSelectableList__list > ul) { + @include euiFocusRing; + } } } diff --git a/src/plugins/unified_histogram/public/chart/chart.tsx b/src/plugins/unified_histogram/public/chart/chart.tsx index 52a6cd4319f554..657f27a72c0702 100644 --- a/src/plugins/unified_histogram/public/chart/chart.tsx +++ b/src/plugins/unified_histogram/public/chart/chart.tsx @@ -277,58 +277,68 @@ export function Chart({ responsive={false} > - - - {renderCustomChartToggleActions ? ( - renderCustomChartToggleActions() - ) : ( - - )} - - {chartVisible && !isPlainRecord && !!onTimeIntervalChange && ( - - - - )} - -
- {chartVisible && breakdown && ( - - )} - {chartVisible && - currentSuggestion && - allSuggestions && - allSuggestions?.length > 1 && ( - + + + + {renderCustomChartToggleActions ? ( + renderCustomChartToggleActions() + ) : ( + )} -
+
+ {chartVisible && !isPlainRecord && !!onTimeIntervalChange && ( + + + + )} + +
+ {chartVisible && breakdown && ( + + )} + {chartVisible && + currentSuggestion && + allSuggestions && + allSuggestions?.length > 1 && ( + + )} +
+
+
{chartVisible && actions.length > 0 && ( diff --git a/src/plugins/unified_histogram/public/chart/suggestion_selector.tsx b/src/plugins/unified_histogram/public/chart/suggestion_selector.tsx index 0196387633396b..cad20279bfdf01 100644 --- a/src/plugins/unified_histogram/public/chart/suggestion_selector.tsx +++ b/src/plugins/unified_histogram/public/chart/suggestion_selector.tsx @@ -75,6 +75,8 @@ export const SuggestionSelector = ({ position="top" content={suggestionsPopoverDisabled ? undefined : activeSuggestion?.title} anchorProps={{ css: suggestionComboCss }} + display="block" + delay="long" > = ({ const { euiTheme } = useEuiTheme(); const [isOpen, setIsOpen] = useState(false); const [searchTerm, setSearchTerm] = useState(); + const [labelPopoverDisabled, setLabelPopoverDisabled] = useState(false); + + const disableLabelPopover = useCallback(() => setLabelPopoverDisabled(true), []); + + const enableLabelPopover = useCallback( + () => setTimeout(() => setLabelPopoverDisabled(false)), + [] + ); const onSelectionChange = useCallback( (newOptions) => { @@ -57,15 +66,24 @@ export const ToolbarSelector: React.FC = ({ chosenOption?.value && chosenOption?.value !== EMPTY_OPTION ? chosenOption : undefined ); setIsOpen(false); + disableLabelPopover(); }, - [onChange, setIsOpen] + [disableLabelPopover, onChange] ); const searchProps: EuiSelectableProps['searchProps'] = useMemo( () => searchable ? { + id: `${dataTestSubj}SelectableInput`, 'data-test-subj': `${dataTestSubj}SelectorSearch`, + compressed: true, + placeholder: i18n.translate( + 'unifiedHistogram.toolbarSelectorPopover.searchPlaceholder', + { + defaultMessage: 'Search', + } + ), onChange: (value) => setSearchTerm(value), } : undefined, @@ -78,62 +96,79 @@ export const ToolbarSelector: React.FC = ({ setIsOpen(!isOpen)} - /> + + setIsOpen(!isOpen)} + onBlur={enableLabelPopover} + /> + } isOpen={isOpen} closePopover={() => setIsOpen(false)} anchorPosition="downLeft" > - - - {popoverTitle} - - + {popoverTitle} {searchTerm}, - }} - /> +

+ {searchTerm}, + }} + /> +

), } : {})} > {(list, search) => ( <> - {search} + {search && ( + + {search} + + )} {list} )}