From 2daea52e277044aec1ea66b341b6ac9c8349a457 Mon Sep 17 00:00:00 2001 From: Weronika Olejniczak <32842468+weronikaolejniczak@users.noreply.github.com> Date: Fri, 29 May 2026 12:14:08 +0200 Subject: [PATCH] feat(kibana-data-discovery): replace title props and wrap EuiButtonIcon with EuiToolTip (#271481) Closes https://github.com/elastic/kibana/issues/270161 Relates to https://github.com/elastic/eui/issues/9566 > [!IMPORTANT] > These changes **should be carefully tested visually by each code owner.** Wrapping with `EuiToolTip` instead of passing `title` leads to another DOM node and can potentially break the layout. In such cases, I would appreciate committing appropriate fixes to this PR directly, I cannot possibly setup and run all Kibana functionalities to fix every regression. This PR: - wraps ALL `EuiButtonIcon` with `EuiToolTip`, the content is the same as `aria-label`, any `title` passed to `EuiButtonIcon` is removed, - changes several `title` cases (not truncation related) to use `EuiToolTip` instead (if applicable). --------- Co-authored-by: Alexey Antonov Co-authored-by: Ania Kowalska <63072419+akowalska622@users.noreply.github.com> (cherry picked from commit 5993118004d1e0e99ae35c3c13f99f1bce070894) # Conflicts: # src/platform/packages/shared/kbn-unified-histogram/components/chart/chart.tsx --- .../kbn-split-button/src/split_button.tsx | 29 +++-- .../in_table_search_input.test.tsx.snap | 120 ++++++++++-------- .../src/in_table_search_input.tsx | 47 ++++--- .../components/chart/chart.tsx | 24 ++-- .../src/hooks/use_responsive_tabs.tsx | 40 +++--- .../preview/documents_nav_preview.tsx | 59 ++++++--- .../preview/field_list/field_list_item.tsx | 43 ++++--- .../index_header/index_header.tsx | 34 +++-- .../components/table/table.tsx | 87 +++++++------ .../syntax_suggestions_popover.tsx | 17 ++- .../doc_viewer_table/table_cell_value.tsx | 23 ++-- .../apps/lens/group2/layer_actions.ts | 9 +- 12 files changed, 310 insertions(+), 222 deletions(-) diff --git a/src/platform/packages/private/kbn-split-button/src/split_button.tsx b/src/platform/packages/private/kbn-split-button/src/split_button.tsx index e813bbc483f8e..943e07d14085c 100644 --- a/src/platform/packages/private/kbn-split-button/src/split_button.tsx +++ b/src/platform/packages/private/kbn-split-button/src/split_button.tsx @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { EuiButton, EuiButtonIcon, useEuiTheme } from '@elastic/eui'; +import { EuiButton, EuiButtonIcon, EuiToolTip, useEuiTheme } from '@elastic/eui'; import type { EuiButtonProps, IconType, UseEuiTheme } from '@elastic/eui'; import { useMemoCss } from '@kbn/css-utils/public/use_memo_css'; import React from 'react'; @@ -81,19 +81,20 @@ export const SplitButton = ({ ) : ( )} - + + + ); }; diff --git a/src/platform/packages/shared/kbn-data-grid-in-table-search/src/__snapshots__/in_table_search_input.test.tsx.snap b/src/platform/packages/shared/kbn-data-grid-in-table-search/src/__snapshots__/in_table_search_input.test.tsx.snap index fba83bc92ddba..1114cfa29c9b6 100644 --- a/src/platform/packages/shared/kbn-data-grid-in-table-search/src/__snapshots__/in_table_search_input.test.tsx.snap +++ b/src/platform/packages/shared/kbn-data-grid-in-table-search/src/__snapshots__/in_table_search_input.test.tsx.snap @@ -49,36 +49,46 @@ exports[`InTableSearchInput renders input 1`] = `
- + +
- + +
@@ -144,38 +154,48 @@ exports[`InTableSearchInput renders input when loading 1`] = `
- + +
- + +
diff --git a/src/platform/packages/shared/kbn-data-grid-in-table-search/src/in_table_search_input.tsx b/src/platform/packages/shared/kbn-data-grid-in-table-search/src/in_table_search_input.tsx index 5c3ac0fc4c5a1..78f06bbb5b1c1 100644 --- a/src/platform/packages/shared/kbn-data-grid-in-table-search/src/in_table_search_input.tsx +++ b/src/platform/packages/shared/kbn-data-grid-in-table-search/src/in_table_search_input.tsx @@ -15,6 +15,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiText, + EuiToolTip, keys, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -119,28 +120,42 @@ export const InTableSearchInput: React.FC = React.memo( - + disableScreenReaderOutput + > + + - + disableScreenReaderOutput + > + + } diff --git a/src/platform/packages/shared/kbn-unified-histogram/components/chart/chart.tsx b/src/platform/packages/shared/kbn-unified-histogram/components/chart/chart.tsx index d1d441e929110..3d6b2642beb9e 100644 --- a/src/platform/packages/shared/kbn-unified-histogram/components/chart/chart.tsx +++ b/src/platform/packages/shared/kbn-unified-histogram/components/chart/chart.tsx @@ -268,20 +268,24 @@ export function UnifiedHistogramChart({ const actions: IconButtonGroupProps['buttons'] = []; if (canEditVisualizationOnTheFly) { + const editLabel = i18n.translate('unifiedHistogram.editVisualizationButton', { + defaultMessage: 'Edit visualization', + }); actions.push({ - label: i18n.translate('unifiedHistogram.editVisualizationButton', { - defaultMessage: 'Edit visualization', - }), + label: editLabel, + toolTipContent: editLabel, iconType: 'pencil', isDisabled: isFlyoutVisible, 'data-test-subj': 'unifiedHistogramEditFlyoutVisualization', onClick: () => setIsFlyoutVisible(true), }); } else if (onEditVisualization) { + const editLabel = i18n.translate('unifiedHistogram.editVisualizationButton', { + defaultMessage: 'Edit visualization', + }); actions.push({ - label: i18n.translate('unifiedHistogram.editVisualizationButton', { - defaultMessage: 'Edit visualization', - }), + label: editLabel, + toolTipContent: editLabel, iconType: 'lensApp', 'data-test-subj': 'unifiedHistogramEditVisualization', onClick: onEditVisualization, @@ -289,10 +293,12 @@ export function UnifiedHistogramChart({ } if (canSaveVisualization) { + const saveLabel = i18n.translate('unifiedHistogram.saveVisualizationButton', { + defaultMessage: 'Save visualization to dashboard', + }); actions.push({ - label: i18n.translate('unifiedHistogram.saveVisualizationButton', { - defaultMessage: 'Save visualization to dashboard', - }), + label: saveLabel, + toolTipContent: saveLabel, iconType: 'dashboardApp', 'data-test-subj': 'unifiedHistogramSaveVisualization', onClick: () => setIsSaveModalVisible(true), diff --git a/src/platform/packages/shared/kbn-unified-tabs/src/hooks/use_responsive_tabs.tsx b/src/platform/packages/shared/kbn-unified-tabs/src/hooks/use_responsive_tabs.tsx index e434b88092b52..87fe8d39efc80 100644 --- a/src/platform/packages/shared/kbn-unified-tabs/src/hooks/use_responsive_tabs.tsx +++ b/src/platform/packages/shared/kbn-unified-tabs/src/hooks/use_responsive_tabs.tsx @@ -8,7 +8,7 @@ */ import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { EuiButtonIcon, useEuiTheme, useResizeObserver } from '@elastic/eui'; +import { EuiButtonIcon, EuiToolTip, useEuiTheme, useResizeObserver } from '@elastic/eui'; import { throttle } from 'lodash'; import { i18n } from '@kbn/i18n'; import { css } from '@emotion/react'; @@ -97,15 +97,16 @@ export const useResponsiveTabs = ({ const scrollLeftButton = useMemo( () => tabsSizeConfig.isScrollable ? ( - + + + ) : null, [scrollLeftButtonLabel, scrollLeft, tabsSizeConfig.isScrollable, scrollState?.isScrollableLeft] ); @@ -113,15 +114,16 @@ export const useResponsiveTabs = ({ const scrollRightButton = useMemo( () => tabsSizeConfig.isScrollable ? ( - + + + ) : null, [ scrollRightButtonLabel, diff --git a/src/platform/plugins/shared/data_view_field_editor/public/components/preview/documents_nav_preview.tsx b/src/platform/plugins/shared/data_view_field_editor/public/components/preview/documents_nav_preview.tsx index f9e6ddff02329..2ace10764adfa 100644 --- a/src/platform/plugins/shared/data_view_field_editor/public/components/preview/documents_nav_preview.tsx +++ b/src/platform/plugins/shared/data_view_field_editor/public/components/preview/documents_nav_preview.tsx @@ -10,12 +10,13 @@ import React, { useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { + EuiButtonEmpty, + EuiButtonIcon, + EuiFieldText, EuiFlexGroup, EuiFlexItem, EuiFormRow, - EuiFieldText, - EuiButtonIcon, - EuiButtonEmpty, + EuiToolTip, } from '@elastic/eui'; import { useStateSelector } from '../../state_utils'; import type { PreviewState } from './types'; @@ -107,34 +108,54 @@ export const DocumentsNavPreview = () => { - + disableScreenReaderOutput + > + + - + disableScreenReaderOutput + > + + diff --git a/src/platform/plugins/shared/data_view_field_editor/public/components/preview/field_list/field_list_item.tsx b/src/platform/plugins/shared/data_view_field_editor/public/components/preview/field_list/field_list_item.tsx index 144379f83f54f..22ec2fe143dbc 100644 --- a/src/platform/plugins/shared/data_view_field_editor/public/components/preview/field_list/field_list_item.tsx +++ b/src/platform/plugins/shared/data_view_field_editor/public/components/preview/field_list/field_list_item.tsx @@ -167,24 +167,31 @@ export const PreviewListItem: React.FC = ({ {toggleIsPinned && ( - { - const isKeyboardEvent = e.detail === 0; // Mouse = non-zero, Keyboard = 0 - toggleIsPinned(key, { isKeyboardEvent, buttonId: pinButtonId }); - }} - id={pinButtonId} - onFocus={() => setIsPinFocused(true)} - onBlur={() => setIsPinFocused(false)} - color="text" - iconType={showPinIcon ? 'pinFill' : 'empty'} - data-test-subj="pinFieldButton" - aria-label={i18n.translate( - 'indexPatternFieldEditor.fieldPreview.pinFieldButtonLabel', - { - defaultMessage: 'Pin field', - } - )} - /> + + { + const isKeyboardEvent = e.detail === 0; // Mouse = non-zero, Keyboard = 0 + toggleIsPinned(key, { isKeyboardEvent, buttonId: pinButtonId }); + }} + id={pinButtonId} + onFocus={() => setIsPinFocused(true)} + onBlur={() => setIsPinFocused(false)} + color="text" + iconType={showPinIcon ? 'pinFill' : 'empty'} + data-test-subj="pinFieldButton" + aria-label={i18n.translate( + 'indexPatternFieldEditor.fieldPreview.pinFieldButtonLabel', + { + defaultMessage: 'Pin field', + } + )} + /> + )} diff --git a/src/platform/plugins/shared/data_view_management/public/components/edit_index_pattern/index_header/index_header.tsx b/src/platform/plugins/shared/data_view_management/public/components/edit_index_pattern/index_header/index_header.tsx index d89cbba9abadb..43891dad5734e 100644 --- a/src/platform/plugins/shared/data_view_management/public/components/edit_index_pattern/index_header/index_header.tsx +++ b/src/platform/plugins/shared/data_view_management/public/components/edit_index_pattern/index_header/index_header.tsx @@ -20,6 +20,7 @@ import { EuiPageHeader, EuiPopover, EuiText, + EuiToolTip, } from '@elastic/eui'; import type { DataView } from '@kbn/data-views-plugin/public'; @@ -101,19 +102,26 @@ export const IndexHeader: FC> = ({ } )} button={ - setIsOpen((prevIsOpen) => !prevIsOpen)} - size="m" - data-test-subj="moreActionsButton" - aria-label={i18n.translate( - 'indexPatternManagement.editDataView.moreActionsButtonAria', - { - defaultMessage: 'More Actions', - } - )} - color="text" - /> + + setIsOpen((prevIsOpen) => !prevIsOpen)} + size="m" + data-test-subj="moreActionsButton" + aria-label={i18n.translate( + 'indexPatternManagement.editDataView.moreActionsButtonAria', + { + defaultMessage: 'More Actions', + } + )} + color="text" + /> + } > diff --git a/src/platform/plugins/shared/data_view_management/public/components/edit_index_pattern/source_filters_table/components/table/table.tsx b/src/platform/plugins/shared/data_view_management/public/components/edit_index_pattern/source_filters_table/components/table/table.tsx index 0ceb0bff01b55..cd11251537922 100644 --- a/src/platform/plugins/shared/data_view_management/public/components/edit_index_pattern/source_filters_table/components/table/table.tsx +++ b/src/platform/plugins/shared/data_view_management/public/components/edit_index_pattern/source_filters_table/components/table/table.tsx @@ -11,12 +11,13 @@ import React, { Component } from 'react'; import type { EuiBasicTableColumn } from '@elastic/eui'; import { - keys, - EuiInMemoryTable, - EuiFieldText, - EuiButtonIcon, EuiButtonEmpty, + EuiButtonIcon, + EuiFieldText, + EuiInMemoryTable, + EuiToolTip, RIGHT_ALIGNMENT, + keys, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -258,47 +259,55 @@ class TableClass extends Component< if (this.state.editingFilterId === filter.clientId) { return ( <> - { - saveFilter({ - clientId: this.state.editingFilterId, - value: this.state.editingFilterValue, - }); - this.stopEditingFilter(); - }} - iconType="checkCircleFill" - aria-label={saveAria} - data-test-subj={`save_filter-${filter.value}`} - /> - { - this.stopEditingFilter(); - }} - iconType="cross" - aria-label={cancelAria} - /> + + { + saveFilter({ + clientId: this.state.editingFilterId, + value: this.state.editingFilterValue, + }); + this.stopEditingFilter(); + }} + iconType="checkCircleFill" + aria-label={saveAria} + data-test-subj={`save_filter-${filter.value}`} + /> + + + { + this.stopEditingFilter(); + }} + iconType="cross" + aria-label={cancelAria} + /> + ); } return ( <> - this.startEditingFilter(filter.clientId, filter.value)} - iconType="pencil" - aria-label={editAria} - data-test-subj={`edit_filter-${filter.value}`} - /> - deleteFilter(filter)} - iconType="trash" - aria-label={deleteAria} - /> + + this.startEditingFilter(filter.clientId, filter.value)} + iconType="pencil" + aria-label={editAria} + data-test-subj={`edit_filter-${filter.value}`} + /> + + + deleteFilter(filter)} + iconType="trash" + aria-label={deleteAria} + /> + ); }, diff --git a/src/platform/plugins/shared/discover/public/application/main/components/no_results/no_results_suggestions/syntax_suggestions_popover.tsx b/src/platform/plugins/shared/discover/public/application/main/components/no_results/no_results_suggestions/syntax_suggestions_popover.tsx index f0e1d2cbe8599..509da57861792 100644 --- a/src/platform/plugins/shared/discover/public/application/main/components/no_results/no_results_suggestions/syntax_suggestions_popover.tsx +++ b/src/platform/plugins/shared/discover/public/application/main/components/no_results/no_results_suggestions/syntax_suggestions_popover.tsx @@ -12,12 +12,13 @@ import { css } from '@emotion/react'; import { EuiBasicTable, EuiButtonIcon, + EuiCode, EuiPanel, EuiPopover, EuiPopoverTitle, - EuiCode, - EuiText, EuiSpacer, + EuiText, + EuiToolTip, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -41,11 +42,13 @@ export const SyntaxSuggestionsPopover: React.FC = const { title, items, footer } = meta; const helpButton = ( - setIsOpen((prev) => !prev)} - iconType="documentation" - aria-label={title} - /> + + setIsOpen((prev) => !prev)} + iconType="documentation" + aria-label={title} + /> + ); const columns = [ diff --git a/src/platform/plugins/shared/unified_doc_viewer/public/components/doc_viewer_table/table_cell_value.tsx b/src/platform/plugins/shared/unified_doc_viewer/public/components/doc_viewer_table/table_cell_value.tsx index c71b29973e24e..f553e65b39e3f 100644 --- a/src/platform/plugins/shared/unified_doc_viewer/public/components/doc_viewer_table/table_cell_value.tsx +++ b/src/platform/plugins/shared/unified_doc_viewer/public/components/doc_viewer_table/table_cell_value.tsx @@ -166,17 +166,18 @@ export const TableFieldValue = ({ {isCollapsible && ( - + + + )} diff --git a/x-pack/platform/test/functional/apps/lens/group2/layer_actions.ts b/x-pack/platform/test/functional/apps/lens/group2/layer_actions.ts index d179811e89631..8972ea6674b79 100644 --- a/x-pack/platform/test/functional/apps/lens/group2/layer_actions.ts +++ b/x-pack/platform/test/functional/apps/lens/group2/layer_actions.ts @@ -170,13 +170,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should switch to pie chart and have layer settings available', async () => { - await retry.try(async () => { - // click on the tab navigation left button 10 times to make the first tab visible - for (let i = 0; i < 10; i++) { - await testSubjects.click('unifiedTabs_tabsBar_scrollLeftBtn'); - } - await lens.ensureLayerTabIsActive(0); - }); + await lens.ensureLayerTabIsActive(0); + await lens.switchToVisualization('pie'); // layer settings still available // open the panel