Skip to content

feat(eslint-plugin): add new @elastic/eui/callout-announce-on-mount rule - #9005

Merged
weronikaolejniczak merged 7 commits into
elastic:mainfrom
paulinashakirova:eslint-rule-announceOnMount-callout
Sep 15, 2025
Merged

weronikaolejniczak merged 7 commits into
elastic:mainfrom
paulinashakirova:eslint-rule-announceOnMount-callout

Conversation

@paulinashakirova

@paulinashakirova paulinashakirova commented Sep 10, 2025 •

Copy link
Copy Markdown

Summary

This PR introduces a new ESLint rule

  • @elastic/eui/callout-announce-on-mount

Problem

When callouts appear dynamically (e.g., after user interactions, form validation errors, or status changes), screen readers may not announce their content to users.
The announceOnMount prop ensures these messages are properly announced to users with assistive technologies.

Screen.Recording.2025-09-10.at.21.22.15.mov

@paulinashakirova paulinashakirova changed the title [a11y] Add a rule for conditionally rendered EuiCallOut feat(eslint-plugin): add new @elastic/eui/callout-announce-on-mount rule Sep 10, 2025
schema: [],
messages: {
missingAnnounceOnMount: [
'EuiCallout should have "announceOnMount" prop when conditionally rendered for better accessibility.',

@alexwizp alexwizp Sep 11, 2025 •

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.

please replace EuiCallout -> CALLOUT_COMPONENT (for all places) + in description

};
},
meta: {
type: 'suggestion',

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.

let's set problem?

return;
}
if (isInConditionalRendering(node)) {
const hasSpread = openingElement.attributes.some(a => a.type === 'JSXSpreadAttribute');

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.

can we reuse packages/eslint-plugin/src/utils/has_spread.ts


export const CallOutAnnounceOnMount = ESLintUtils.RuleCreator.withoutDocs({
create(context) {
function isInConditionalRendering(node: TSESTree.JSXElement): boolean {

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.

candidate for moving into packages/eslint-plugin/src/utils/

@paulinashakirova
paulinashakirova marked this pull request as ready for review September 12, 2025 12:40
@paulinashakirova
paulinashakirova requested a review from a team as a code owner September 12, 2025 12:40
@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @paulinashakirova

@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @paulinashakirova

@weronikaolejniczak weronikaolejniczak 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.

LGTM 🟢 Thanks for contributing @paulinashakirova! 🥳

@weronikaolejniczak
weronikaolejniczak merged commit e702a59 into elastic:main Sep 15, 2025
weronikaolejniczak added a commit to elastic/kibana that referenced this pull request Sep 16, 2025
- `@elastic/eui`: `v106.5.0` ⏩ `v106.6.0`
- `@elastic/eui-theme-borealis`: `v3.3.2` ⏩ `v3.4.0`
- `@elastic/eslint-plugin-eui`: `v2.3.0` ⏩ `v2.4.0`

[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)

## Package updates

### `@elastic/eui`

#### [`v106.6.0`](https://github.com/elastic/eui/releases/v106.6.0)

**Accessibility**

- Removed focus state styles for `iconOnClick` on `EuiBadge` to improve
color contrast in dark mode
([#9004](elastic/eui#9004))

### `@elastic/eui-theme-borealis`

####
[`v3.4.0`](https://www.npmjs.com/package/@elastic/eui-theme-borealis/v/3.4.0)

- Updated values for component tokens
([#8983](elastic/eui#8983))
  - `dataGridRowStripesBackgroundHover`
  - `dataGridRowStripesBackgroundStripedHover`
  - `dataGridRowStripesBackgroundSelectHover`
  - `dataGridRowStripesBackgroundHover`
  - `dataGridRowStripesBackgroundStripedHover`

### `@elastic/eslint-plugin-eui`

####
[`v2.4.0`](https://www.npmjs.com/package/@elastic/eslint-plugin-eui/v/2.4.0)

- Added new `callout-announce-on-mount` rule.
([#9005](elastic/eui#9005))
- Added new `no-unnamed-interactive-element` rule.
([#8973](elastic/eui#8973))
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Sep 24, 2025
- `@elastic/eui`: `v106.5.0` ⏩ `v106.6.0`
- `@elastic/eui-theme-borealis`: `v3.3.2` ⏩ `v3.4.0`
- `@elastic/eslint-plugin-eui`: `v2.3.0` ⏩ `v2.4.0`

[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)

## Package updates

### `@elastic/eui`

#### [`v106.6.0`](https://github.com/elastic/eui/releases/v106.6.0)

**Accessibility**

- Removed focus state styles for `iconOnClick` on `EuiBadge` to improve
color contrast in dark mode
([elastic#9004](elastic/eui#9004))

### `@elastic/eui-theme-borealis`

####
[`v3.4.0`](https://www.npmjs.com/package/@elastic/eui-theme-borealis/v/3.4.0)

- Updated values for component tokens
([elastic#8983](elastic/eui#8983))
  - `dataGridRowStripesBackgroundHover`
  - `dataGridRowStripesBackgroundStripedHover`
  - `dataGridRowStripesBackgroundSelectHover`
  - `dataGridRowStripesBackgroundHover`
  - `dataGridRowStripesBackgroundStripedHover`

### `@elastic/eslint-plugin-eui`

####
[`v2.4.0`](https://www.npmjs.com/package/@elastic/eslint-plugin-eui/v/2.4.0)

- Added new `callout-announce-on-mount` rule.
([elastic#9005](elastic/eui#9005))
- Added new `no-unnamed-interactive-element` rule.
([elastic#8973](elastic/eui#8973))
paulinashakirova pushed a commit to elastic/kibana that referenced this pull request Oct 30, 2025
…ceOnMount` in conditional rendered instances (#235054)

## Summary

This PR introduces fix for our new eslint rule
[`@elastic/eui/callout-announce-on-mount`](elastic/eui#9005).

### Problem
tldr; When callouts appear dynamically (e.g., after user interactions,
form validation errors, or status changes), screen readers may not
announce their content to users.
The `announceOnMount` prop ensures these messages are properly announced
to users with assistive technologies.

#### Please double check your code - to make sure that if `EuiCallout`
appears dynamically after a user interaction, the `announceOnMount` is
NOT set to false. I did my best, but might have missed some because of
my lacking context.

> [!NOTE]  
> If `EuiCallOut` is inside a condition, announceOnMount must be set
explicitly.

---------

Co-authored-by: Robert Jaszczurek <[email protected]>
Co-authored-by: Davis McPhee <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Vitalii Dmyterko <[email protected]>
ana-davydova pushed a commit to ana-davydova/kibana that referenced this pull request Nov 3, 2025
…ceOnMount` in conditional rendered instances (elastic#235054)

## Summary

This PR introduces fix for our new eslint rule
[`@elastic/eui/callout-announce-on-mount`](elastic/eui#9005).

### Problem
tldr; When callouts appear dynamically (e.g., after user interactions,
form validation errors, or status changes), screen readers may not
announce their content to users.
The `announceOnMount` prop ensures these messages are properly announced
to users with assistive technologies.

#### Please double check your code - to make sure that if `EuiCallout`
appears dynamically after a user interaction, the `announceOnMount` is
NOT set to false. I did my best, but might have missed some because of
my lacking context.

> [!NOTE]  
> If `EuiCallOut` is inside a condition, announceOnMount must be set
explicitly.

---------

Co-authored-by: Robert Jaszczurek <[email protected]>
Co-authored-by: Davis McPhee <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Vitalii Dmyterko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants