Skip to content

Commit 0e99ced

Browse files
Fix violations of the @elastic/eui/prefer-eui-icon-tip an ESLint rule (elastic#233648)
Closes: elastic#215330 Closes: elastic#215677 Closes: elastic#215904 Closes: elastic#219237 > \[!CAUTION] > ⚠️ Changes were made by GenAI. Please review carefully. ## Motivation This PR fix violations of the `@elastic/eui/prefer-eui-icon-tip` an ESLint rule. ## 📌 Summary This PR refactors instances of: ```tsx <EuiToolTip> <EuiIcon /> </EuiToolTip> ``` to use the `EuiIconTip` component directly, which improves accessibility and offers better support for assistive technologies. ## ✅ Changes Made 1. Replaced all `<EuiToolTip><EuiIcon /></EuiToolTip>` patterns with `<EuiIconTip />`. 2. Migrated relevant props from both `EuiToolTip` and `EuiIcon` into the new `EuiIconTip` --------- Co-authored-by: kibanamachine <[email protected]>
1 parent 55e8677 commit 0e99ced

File tree

128 files changed

+997
-1104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+997
-1104
lines changed

src/platform/packages/private/kbn-esql-editor/src/editor_footer/history_starred_queries.tsx

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
EuiNotificationBadge,
2626
EuiFieldSearch,
2727
EuiText,
28-
EuiIcon,
28+
EuiIconTip,
2929
} from '@elastic/eui';
3030
import { useKibana } from '@kbn/kibana-react-plugin/public';
3131
import { cssFavoriteHoverWithinEuiTableRow } from '@kbn/content-management-favorites-public';
@@ -135,51 +135,48 @@ export const getTableColumns = (
135135
case 'success':
136136
default:
137137
return (
138-
<EuiToolTip
138+
<EuiIconTip
139139
position="top"
140140
content={i18n.translate('esqlEditor.query.querieshistory.success', {
141141
defaultMessage: 'Query ran successfully',
142142
})}
143-
>
144-
<EuiIcon
145-
type="checkInCircleFilled"
146-
color="success"
147-
size="m"
148-
data-test-subj="ESQLEditor-queryHistory-success"
149-
/>
150-
</EuiToolTip>
143+
type="checkInCircleFilled"
144+
color="success"
145+
size="m"
146+
iconProps={{
147+
'data-test-subj': 'ESQLEditor-queryHistory-success',
148+
}}
149+
/>
151150
);
152151
case 'error':
153152
return (
154-
<EuiToolTip
153+
<EuiIconTip
155154
position="top"
156155
content={i18n.translate('esqlEditor.query.querieshistory.error', {
157156
defaultMessage: 'Query failed',
158157
})}
159-
>
160-
<EuiIcon
161-
type="error"
162-
color="danger"
163-
size="m"
164-
data-test-subj="ESQLEditor-queryHistory-error"
165-
/>
166-
</EuiToolTip>
158+
type="error"
159+
color="danger"
160+
size="m"
161+
iconProps={{
162+
'data-test-subj': 'ESQLEditor-queryHistory-error',
163+
}}
164+
/>
167165
);
168166
case 'warning':
169167
return (
170-
<EuiToolTip
168+
<EuiIconTip
171169
position="top"
172170
content={i18n.translate('esqlEditor.query.querieshistory.error', {
173171
defaultMessage: 'Query failed',
174172
})}
175-
>
176-
<EuiIcon
177-
type="warning"
178-
color="warning"
179-
size="m"
180-
data-test-subj="ESQLEditor-queryHistory-warning"
181-
/>
182-
</EuiToolTip>
173+
type="warning"
174+
color="warning"
175+
size="m"
176+
iconProps={{
177+
'data-test-subj': 'ESQLEditor-queryHistory-warning',
178+
}}
179+
/>
183180
);
184181
}
185182
},

src/platform/packages/shared/kbn-coloring/src/shared_components/color_mapping/components/assignment/duplicate_warning.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
import React from 'react';
11-
import { EuiIcon, EuiToolTip } from '@elastic/eui';
11+
import { EuiIconTip } from '@elastic/eui';
1212
import { i18n } from '@kbn/i18n';
1313
import { euiThemeVars } from '@kbn/ui-theme';
1414

@@ -22,8 +22,12 @@ const duplicateWarning = i18n.translate(
2222

2323
export function DuplicateWarning() {
2424
return (
25-
<EuiToolTip position="bottom" content={duplicateWarning}>
26-
<EuiIcon size="s" type="warning" color={euiThemeVars.euiColorWarningText} />
27-
</EuiToolTip>
25+
<EuiIconTip
26+
position="bottom"
27+
content={duplicateWarning}
28+
type="warning"
29+
size="s"
30+
color={euiThemeVars.euiColorWarningText}
31+
/>
2832
);
2933
}

src/platform/packages/shared/kbn-coloring/src/shared_components/color_mapping/components/color_picker/palette_colors.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ import {
1313
EuiFlexGroup,
1414
EuiFlexItem,
1515
EuiHorizontalRule,
16-
EuiIcon,
16+
EuiIconTip,
1717
EuiTitle,
18-
EuiToolTip,
1918
EuiSpacer,
2019
useEuiTheme,
2120
} from '@elastic/eui';
@@ -97,7 +96,7 @@ export function PaletteColors({
9796
{i18n.translate('coloring.colorMapping.colorPicker.themeAwareColorsLabel', {
9897
defaultMessage: 'Neutral colors',
9998
})}
100-
<EuiToolTip
99+
<EuiIconTip
101100
position="bottom"
102101
content={i18n.translate(
103102
'coloring.colorMapping.colorPicker.themeAwareColorsTooltip',
@@ -106,9 +105,8 @@ export function PaletteColors({
106105
'The provided neutral colors are theme-aware and will change appropriately when switching between light and dark themes.',
107106
}
108107
)}
109-
>
110-
<EuiIcon tabIndex={0} type="question" />
111-
</EuiToolTip>
108+
type="question"
109+
/>
112110
</h6>
113111
</EuiTitle>
114112
<EuiSpacer size="s" />

src/platform/packages/shared/kbn-coloring/src/shared_components/color_mapping/components/color_picker/rgb_picker.tsx

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import {
1313
EuiFlexGroup,
1414
EuiFlexItem,
1515
EuiFormRow,
16-
EuiIcon,
17-
EuiToolTip,
16+
EuiIconTip,
1817
} from '@elastic/eui';
1918
import React, { useState } from 'react';
2019
import useDebounce from 'react-use/lib/useDebounce';
@@ -156,7 +155,7 @@ export function RGBPicker({
156155
top: 6px;
157156
`}
158157
>
159-
<EuiToolTip
158+
<EuiIconTip
160159
position="bottom"
161160
content={
162161
isColorTextInvalid
@@ -173,19 +172,15 @@ export function RGBPicker({
173172
})
174173
: undefined
175174
}
176-
>
177-
<EuiIcon
178-
tabIndex={0}
179-
type="warning"
180-
color={
181-
isColorTextInvalid
182-
? euiThemeVars.euiColorDangerText
183-
: colorHasLowContrast
184-
? euiThemeVars.euiColorWarningText
185-
: euiThemeVars.euiColorPrimary
186-
}
187-
/>
188-
</EuiToolTip>
175+
type="warning"
176+
color={
177+
isColorTextInvalid
178+
? euiThemeVars.euiColorDangerText
179+
: colorHasLowContrast
180+
? euiThemeVars.euiColorWarningText
181+
: euiThemeVars.euiColorPrimary
182+
}
183+
/>
189184
</div>
190185
)}
191186
</EuiFlexGroup>

src/platform/packages/shared/response-ops/alerts-fields-browser/components/field_items/field_items.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import React from 'react';
1111
import {
1212
EuiCheckbox,
13-
EuiIcon,
1413
EuiToolTip,
14+
EuiIconTip,
1515
EuiFlexGroup,
1616
EuiFlexItem,
1717
EuiBadge,
@@ -111,13 +111,14 @@ const getDefaultFieldTableColumns = ({ highlight }: { highlight: string }): Fiel
111111
return (
112112
<EuiFlexGroup alignItems="center" gutterSize="none">
113113
<EuiFlexItem grow={false}>
114-
<EuiToolTip content={type}>
115-
<EuiIcon
116-
data-test-subj={`field-${name}-icon`}
117-
css={styles.icon}
118-
type={getIconFromType(type ?? null)}
119-
/>
120-
</EuiToolTip>
114+
<EuiIconTip
115+
content={type}
116+
css={styles.icon}
117+
type={getIconFromType(type ?? null)}
118+
iconProps={{
119+
'data-test-subj': `field-${name}-icon`,
120+
}}
121+
/>
121122
</EuiFlexItem>
122123

123124
<EuiFlexItem grow={false}>

src/platform/packages/shared/response-ops/rule_form/src/rule_actions/rule_actions_item.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
EuiPanel,
1818
EuiButtonIcon,
1919
useEuiTheme,
20-
EuiIcon,
20+
EuiIconTip,
2121
EuiText,
2222
EuiTabs,
2323
EuiTab,
@@ -557,34 +557,34 @@ export const RuleActionsItem = (props: RuleActionsItemProps) => {
557557
if (!connector || !actionType) {
558558
return (
559559
<EuiFlexItem grow={false}>
560-
<EuiToolTip content={ACTION_UNABLE_TO_LOAD_CONNECTOR_TITLE}>
561-
<EuiIcon
562-
data-test-subj="action-group-error-icon"
563-
type="warning"
564-
color="danger"
565-
size="l"
566-
/>
567-
</EuiToolTip>
560+
<EuiIconTip
561+
content={ACTION_UNABLE_TO_LOAD_CONNECTOR_TITLE}
562+
type="warning"
563+
color="danger"
564+
size="l"
565+
iconProps={{
566+
'data-test-subj': 'action-group-error-icon',
567+
}}
568+
/>
568569
</EuiFlexItem>
569570
);
570571
}
571572

572573
return (
573574
<EuiFlexItem grow={false}>
574575
{showActionGroupErrorIcon ? (
575-
<EuiToolTip content={ACTION_ERROR_TOOLTIP}>
576-
<EuiIcon
577-
data-test-subj="action-group-error-icon"
578-
type="warning"
579-
color="danger"
580-
size="l"
581-
/>
582-
</EuiToolTip>
576+
<EuiIconTip
577+
content={ACTION_ERROR_TOOLTIP}
578+
type="warning"
579+
color="danger"
580+
size="l"
581+
iconProps={{
582+
'data-test-subj': 'action-group-error-icon',
583+
}}
584+
/>
583585
) : (
584586
<Suspense fallback={null}>
585-
<EuiToolTip content={actionType.name}>
586-
<EuiIcon size="l" type={actionTypeModel.iconClass} />
587-
</EuiToolTip>
587+
<EuiIconTip content={actionType.name} type={actionTypeModel.iconClass} size="l" />
588588
</Suspense>
589589
)}
590590
</EuiFlexItem>

src/platform/packages/shared/response-ops/rule_form/src/rule_actions/rule_actions_system_actions_item.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
EuiButtonIcon,
1515
EuiFlexGroup,
1616
EuiFlexItem,
17-
EuiIcon,
17+
EuiIconTip,
1818
EuiPanel,
1919
EuiText,
2020
EuiToolTip,
@@ -278,19 +278,22 @@ export const RuleActionsSystemActionsItem = (props: RuleActionsSystemActionsItem
278278
<EuiFlexGroup alignItems="center">
279279
<EuiFlexItem grow={false}>
280280
{showActionGroupErrorIcon() ? (
281-
<EuiToolTip content={ACTION_ERROR_TOOLTIP}>
282-
<EuiIcon
283-
data-test-subj="action-group-error-icon"
284-
type="warning"
285-
color="danger"
286-
size="l"
287-
/>
288-
</EuiToolTip>
281+
<EuiIconTip
282+
content={ACTION_ERROR_TOOLTIP}
283+
type="warning"
284+
color="danger"
285+
size="l"
286+
iconProps={{
287+
'data-test-subj': 'action-group-error-icon',
288+
}}
289+
/>
289290
) : (
290291
<Suspense fallback={null}>
291-
<EuiToolTip content={actionType?.name}>
292-
<EuiIcon size="l" type={actionTypeModel.iconClass} />
293-
</EuiToolTip>
292+
<EuiIconTip
293+
content={actionType?.name}
294+
size="l"
295+
type={actionTypeModel.iconClass}
296+
/>
294297
</Suspense>
295298
)}
296299
</EuiFlexItem>

src/platform/plugins/private/input_control_vis/public/components/vis/__snapshots__/form_row.test.tsx.snap

Lines changed: 3 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/platform/plugins/private/input_control_vis/public/components/vis/form_row.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import type { ReactElement } from 'react';
1111
import React from 'react';
1212

13-
import { EuiFormRow, EuiToolTip, EuiIcon } from '@elastic/eui';
13+
import { EuiFormRow, EuiToolTip, EuiIconTip } from '@elastic/eui';
1414

1515
export interface FormRowProps {
1616
label: string;
@@ -33,9 +33,7 @@ export function FormRow(props: FormRowProps) {
3333

3434
const label = props.warningMsg ? (
3535
<>
36-
<EuiToolTip position="top" content={props.warningMsg}>
37-
<EuiIcon type="warning" />
38-
</EuiToolTip>
36+
<EuiIconTip content={props.warningMsg} type="warning" position="top" />
3937
{props.label}
4038
</>
4139
) : (

src/platform/plugins/shared/data/public/search/session/sessions_mgmt/components/table/columns/app_id.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
import type { EuiBasicTableColumn } from '@elastic/eui';
11-
import { EuiIcon, EuiToolTip } from '@elastic/eui';
11+
import { EuiIconTip } from '@elastic/eui';
1212
import { i18n } from '@kbn/i18n';
1313
import React from 'react';
1414
import { capitalize } from 'lodash';
@@ -44,13 +44,13 @@ export const appIdColumn: EuiBasicTableColumn<UISession> = {
4444
render: (appId: UISession['appId'], { id }) => {
4545
const app = `${appToIcon(appId)}`;
4646
return (
47-
<EuiToolTip content={appToTooltip(appId) ?? capitalize(app)}>
48-
<EuiIcon
49-
data-test-subj="sessionManagementAppIcon"
50-
data-test-app-id={app}
51-
type={`${app}App`}
52-
/>
53-
</EuiToolTip>
47+
<EuiIconTip
48+
content={appToTooltip(appId) ?? capitalize(app)}
49+
type={`${app}App`}
50+
iconProps={{
51+
'data-test-subj': 'sessionManagementAppIcon',
52+
}}
53+
/>
5454
);
5555
},
5656
};

0 commit comments

Comments
 (0)