Skip to content

[ESLint][EuiToolTip] Add ESLint rules for tooltip best practices - #9635

Merged
weronikaolejniczak merged 8 commits into
elastic:mainfrom
weronikaolejniczak:feat/tooltip-eslint-rules
May 13, 2026
Merged

weronikaolejniczak merged 8 commits into
elastic:mainfrom
weronikaolejniczak:feat/tooltip-eslint-rules

Conversation

@weronikaolejniczak

@weronikaolejniczak weronikaolejniczak commented May 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

API Changes

N/A

Screenshots

N/A

Impact Assessment

Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.

  • 🔴 Breaking changes — What will break? How many usages in Kibana/Cloud UI are impacted?
  • 💅 Visual changes — May impact style overrides; could require visual testing. Explain and estimate impact.
  • 🧪 Test impact — May break functional or snapshot tests (e.g., HTML structure, class names, default values).
  • 🔧 Hard to integrate — If changes require substantial updates to Kibana, please stage the changes and link them here.

Impact level: 🟢 None

Release Readiness

  • Documentation: {link to docs page(s)}
  • Figma: {link to Figma or issue}
  • Migration guide: {steps or link, for breaking/visual changes or deprecations}
  • Adoption plan (new features): {link to issue/doc or outline who will integrate this and where}

QA instructions for reviewer

  • Verify tests are passing locally: yarn workspace @elastic/eslint-plugin-eui test
  • Verify that both rules are comprehensive
PASS src/rules/a11y/tooltip_no_interactive_content.test.ts
PASS src/rules/a11y/require_aria_label_for_modals.test.ts
PASS src/rules/a11y/no_unnamed_interactive_element.test.ts
PASS src/rules/a11y/tooltip_focusable_anchor.test.ts
PASS src/rules/a11y/consistent_is_invalid_props.test.ts
PASS src/rules/prefer_tooltip_trigger_focus_test_utility.test.ts
PASS src/rules/a11y/tooltip_button_icon_wrap.test.ts
PASS src/rules/no_static_z_index.test.ts
PASS src/rules/a11y/callout_announce_on_mount.test.ts
PASS src/rules/no_css_color.test.ts
PASS src/rules/href_or_on_click.test.ts
PASS src/rules/no_restricted_eui_imports.test.ts
PASS src/rules/a11y/prefer_eui_icon_tip.test.ts
PASS src/rules/a11y/sr_output_disabled_tooltip.test.ts
PASS src/rules/a11y/icon_accessibility_rules.test.ts
PASS src/rules/a11y/badge_accessibility_rules.test.ts
PASS src/rules/a11y/no_unnamed_radio_group.test.ts
PASS src/rules/a11y/require_table_caption.test.ts
PASS src/rules/a11y/accessible_interactive_elements.test.ts

Test Suites: 19 passed, 19 total
Tests:       229 passed, 229 total
Snapshots:   0 total
Time:        4.024 s
Ran all test suites matching /src/i.

Checklist before marking Ready for Review

Reviewer checklist

  • Approved Impact Assessment — Acceptable to merge given the consumer impact.
  • Approved Release Readiness — Docs, Figma, and migration info are sufficient to ship.

@weronikaolejniczak weronikaolejniczak self-assigned this May 5, 2026
@weronikaolejniczak
weronikaolejniczak force-pushed the feat/tooltip-eslint-rules branch 2 times, most recently from 0ee7d72 to 2803da0 Compare May 6, 2026 15:02
@weronikaolejniczak
weronikaolejniczak marked this pull request as ready for review May 6, 2026 15:04
@weronikaolejniczak
weronikaolejniczak requested a review from a team as a code owner May 6, 2026 15:04
Copilot AI review requested due to automatic review settings May 6, 2026 15:04
@weronikaolejniczak
weronikaolejniczak requested review from Copilot and removed request for Copilot May 11, 2026 06:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

@weronikaolejniczak
weronikaolejniczak force-pushed the feat/tooltip-eslint-rules branch from 2803da0 to 1c75768 Compare May 12, 2026 18:23
@acstll
acstll self-requested a review May 13, 2026 07:50

@acstll acstll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Code looks good, i couldn't find anything myself! "Forwarding" 2 comments related to tests that Claude spotted. I don't think they're blocking, but worth considering.

Comment thread packages/eslint-plugin/README.md Resolved
@weronikaolejniczak

Copy link
Copy Markdown
Contributor Author

I addressed your comments on c49f0c4, @acstll. Thank you for the review 🙏🏻

@weronikaolejniczak
weronikaolejniczak enabled auto-merge (squash) May 13, 2026 11:53
@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @weronikaolejniczak

@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @weronikaolejniczak

@weronikaolejniczak
weronikaolejniczak merged commit 71a7650 into elastic:main May 13, 2026
1 check passed
alexwizp added a commit to elastic/kibana that referenced this pull request May 28, 2026
## Summary

Updates the `accessibility` agent skill
(`.agents/skills/accessibility/`) with the two new accessibility ESLint
rules shipped in
[`elastic/eui#9635`](elastic/eui#9635)

- **`@elastic/eui/tooltip-button-icon-wrap`** — every `EuiButtonIcon`
must be wrapped in `EuiToolTip` (no native `title` prop). Auto-fixable.
- **`@elastic/eui/tooltip-no-interactive-content`** — no focusable
elements inside `EuiToolTip` / `EuiIconTip` `content` or `title` props.
Not auto-fixable.

Both rules ship as `warn` in `@elastic/eslint-plugin-eui`'s recommended
config, so the agent skill should describe the canonical fix patterns
and the manual-review cases the rule cannot resolve automatically.

## Changes

- **`references/components/tooltip_icon.md`** — rewritten to cover the
full canonical pattern for the `EuiToolTip` + `EuiButtonIcon` pair: wrap
every `EuiButtonIcon` with `EuiToolTip`, drop the native `title` prop,
keep `aria-label`, and add `disableScreenReaderOutput` when `content`
and `aria-label` match. Examples expanded with the new WRONG/RIGHT cases
(no-wrap, native `title`).
- **`references/components/tooltip_content.md`** *(new)* — canonical
guide for the `tooltip-no-interactive-content` rule. Lists allowed
content (plain strings, non-interactive JSX, display-only `EuiBadge` /
`EuiBetaBadge` / `EuiCard`) and the focusable blocklist (native
`a`/`button`/`input`/`select`/`textarea` + interactive EUI components).
Documents the canonical fix (switch to `EuiPopover`) and the
manual-review cases the rule deliberately skips: variable `content` /
`title` and conditionally-interactive badges/cards that gain `onClick` /
`href`. Examples cover nesting in fragments, `cond && …`, ternaries, and
the `title=` prop (not just `content=`).
- **`references/components/index.md`** — added `tooltip_content.md` row;
updated `tooltip_icon.md` topic to reflect the broader scope.
- **`references/eslint.md`** — added rows (alphabetically placed) for
`@elastic/eui/tooltip-button-icon-wrap` → `tooltip_icon.md` and
`@elastic/eui/tooltip-no-interactive-content` → `tooltip_content.md`,
each with the manual-review notes the rule cannot resolve automatically.

## Why

The skill is the source of truth coding agents (and humans browsing it)
consult when fixing `@elastic/eui/*` lint violations. Without this
update the two new rules would land with no canonical-usage reference,
and agents would have to re-derive the pattern (and the silently-skipped
edge cases) from rule messages alone.

## Test plan

- Docs-only change in the `accessibility` agent skill; no runtime or
build impact.
- Verified the rules are present and configured as `warn` in
`node_modules/@elastic/eslint-plugin-eui/lib/cjs/index.js`.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
dej611 pushed a commit to dej611/kibana that referenced this pull request May 29, 2026
…71423)

## Summary

Updates the `accessibility` agent skill
(`.agents/skills/accessibility/`) with the two new accessibility ESLint
rules shipped in
[`elastic/eui#9635`](elastic/eui#9635)

- **`@elastic/eui/tooltip-button-icon-wrap`** — every `EuiButtonIcon`
must be wrapped in `EuiToolTip` (no native `title` prop). Auto-fixable.
- **`@elastic/eui/tooltip-no-interactive-content`** — no focusable
elements inside `EuiToolTip` / `EuiIconTip` `content` or `title` props.
Not auto-fixable.

Both rules ship as `warn` in `@elastic/eslint-plugin-eui`'s recommended
config, so the agent skill should describe the canonical fix patterns
and the manual-review cases the rule cannot resolve automatically.

## Changes

- **`references/components/tooltip_icon.md`** — rewritten to cover the
full canonical pattern for the `EuiToolTip` + `EuiButtonIcon` pair: wrap
every `EuiButtonIcon` with `EuiToolTip`, drop the native `title` prop,
keep `aria-label`, and add `disableScreenReaderOutput` when `content`
and `aria-label` match. Examples expanded with the new WRONG/RIGHT cases
(no-wrap, native `title`).
- **`references/components/tooltip_content.md`** *(new)* — canonical
guide for the `tooltip-no-interactive-content` rule. Lists allowed
content (plain strings, non-interactive JSX, display-only `EuiBadge` /
`EuiBetaBadge` / `EuiCard`) and the focusable blocklist (native
`a`/`button`/`input`/`select`/`textarea` + interactive EUI components).
Documents the canonical fix (switch to `EuiPopover`) and the
manual-review cases the rule deliberately skips: variable `content` /
`title` and conditionally-interactive badges/cards that gain `onClick` /
`href`. Examples cover nesting in fragments, `cond && …`, ternaries, and
the `title=` prop (not just `content=`).
- **`references/components/index.md`** — added `tooltip_content.md` row;
updated `tooltip_icon.md` topic to reflect the broader scope.
- **`references/eslint.md`** — added rows (alphabetically placed) for
`@elastic/eui/tooltip-button-icon-wrap` → `tooltip_icon.md` and
`@elastic/eui/tooltip-no-interactive-content` → `tooltip_content.md`,
each with the manual-review notes the rule cannot resolve automatically.

## Why

The skill is the source of truth coding agents (and humans browsing it)
consult when fixing `@elastic/eui/*` lint violations. Without this
update the two new rules would land with no canonical-usage reference,
and agents would have to re-derive the pattern (and the silently-skipped
edge cases) from rule messages alone.

## Test plan

- Docs-only change in the `accessibility` agent skill; no runtime or
build impact.
- Verified the rules are present and configured as `warn` in
`node_modules/@elastic/eslint-plugin-eui/lib/cjs/index.js`.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@JasonStoltz

Copy link
Copy Markdown
Contributor

we want all EuiButtonIcon wrapped with EuiToolTip

If that's the case, should we capture this in our documentation? At minimum, ensure all of the examples that we show demonstrate this.

https://eui.elastic.co/docs/components/navigation/buttons/button/#icon

patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request Aug 5, 2026
…71423)

## Summary

Updates the `accessibility` agent skill
(`.agents/skills/accessibility/`) with the two new accessibility ESLint
rules shipped in
[`elastic/eui#9635`](elastic/eui#9635)

- **`@elastic/eui/tooltip-button-icon-wrap`** — every `EuiButtonIcon`
must be wrapped in `EuiToolTip` (no native `title` prop). Auto-fixable.
- **`@elastic/eui/tooltip-no-interactive-content`** — no focusable
elements inside `EuiToolTip` / `EuiIconTip` `content` or `title` props.
Not auto-fixable.

Both rules ship as `warn` in `@elastic/eslint-plugin-eui`'s recommended
config, so the agent skill should describe the canonical fix patterns
and the manual-review cases the rule cannot resolve automatically.

## Changes

- **`references/components/tooltip_icon.md`** — rewritten to cover the
full canonical pattern for the `EuiToolTip` + `EuiButtonIcon` pair: wrap
every `EuiButtonIcon` with `EuiToolTip`, drop the native `title` prop,
keep `aria-label`, and add `disableScreenReaderOutput` when `content`
and `aria-label` match. Examples expanded with the new WRONG/RIGHT cases
(no-wrap, native `title`).
- **`references/components/tooltip_content.md`** *(new)* — canonical
guide for the `tooltip-no-interactive-content` rule. Lists allowed
content (plain strings, non-interactive JSX, display-only `EuiBadge` /
`EuiBetaBadge` / `EuiCard`) and the focusable blocklist (native
`a`/`button`/`input`/`select`/`textarea` + interactive EUI components).
Documents the canonical fix (switch to `EuiPopover`) and the
manual-review cases the rule deliberately skips: variable `content` /
`title` and conditionally-interactive badges/cards that gain `onClick` /
`href`. Examples cover nesting in fragments, `cond && …`, ternaries, and
the `title=` prop (not just `content=`).
- **`references/components/index.md`** — added `tooltip_content.md` row;
updated `tooltip_icon.md` topic to reflect the broader scope.
- **`references/eslint.md`** — added rows (alphabetically placed) for
`@elastic/eui/tooltip-button-icon-wrap` → `tooltip_icon.md` and
`@elastic/eui/tooltip-no-interactive-content` → `tooltip_content.md`,
each with the manual-review notes the rule cannot resolve automatically.

## Why

The skill is the source of truth coding agents (and humans browsing it)
consult when fixing `@elastic/eui/*` lint violations. Without this
update the two new rules would land with no canonical-usage reference,
and agents would have to re-derive the pattern (and the silently-skipped
edge cases) from rule messages alone.

## Test plan

- Docs-only change in the `accessibility` agent skill; no runtime or
build impact.
- Verified the rules are present and configured as `warn` in
`node_modules/@elastic/eslint-plugin-eui/lib/cjs/index.js`.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ESLint] Add a rule about wrapping EuiButtonIcon with EuiToolTip [ESLint] Add a rule for EuiToolTip to enforce non-interactive content

5 participants