Skip to content

Conversation

@alexwizp
Copy link
Contributor

@alexwizp alexwizp commented Jul 14, 2025

Caution

⚠️ Changes were made by GenAI. Please review carefully.

Summary

This PR applies the auto-fix for the newly introduced @elastic/eui/require-aria-label-for-modals rule. This rule ensures that EUI modal components (EuiModal and EuiFlyout) include either an aria-label or aria-labelledby prop to support screen reader accessibility. These attributes help users understand the purpose and content of modal dialogs.

Changes Made

  1. Identified the modal title/header element used within EuiModal or EuiFlyout.
    Common elements include: EuiFlyoutTitle, EuiModalTitle, EuiTitle, <h2>, <h3>, or other heading tags.

  2. Ensured the title element has an id:
    If the header element lacked an id, one was programmatically generated:

    • For function components:

      • Imported useGeneratedHtmlId from @elastic/eui if not already present:

        import { useGeneratedHtmlId } from '@elastic/eui';
      • Defined a unique ID before the return statement:

        const modalTitleId = useGeneratedHtmlId();
      • Applied the ID to the title element:

        <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
    • For class components:

      • Imported htmlIdGenerator from @elastic/eui if not already present:

        import { htmlIdGenerator } from '@elastic/eui';
      • Defined a unique ID within the render() method:

        const modalTitleId = htmlIdGenerator()('modalTitle');
      • Applied the ID to the title element:

        <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
  3. Updated the EuiModal or EuiFlyout component to include the aria-labelledby attribute referencing the generated title ID:

    <EuiModal aria-labelledby={modalTitleId} />

@alexwizp alexwizp marked this pull request as ready for review July 16, 2025 13:37
@alexwizp alexwizp requested review from a team as code owners July 16, 2025 13:38
@alexwizp alexwizp requested a review from a team July 16, 2025 13:38
@alexwizp alexwizp requested review from a team as code owners July 16, 2025 13:38
@alexwizp alexwizp merged commit a3b63e3 into elastic:main Jul 24, 2025
12 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 9.1

https://github.com/elastic/kibana/actions/runs/16500615336

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
9.1 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.1:
- Auto-fix violations of the @elastic/eui/require-aria-label-for-modals ESLint rule (#227623)

Manual backport

To create the backport manually run:

node scripts/backport --pr 227821

Questions ?

Please refer to the Backport tool documentation

@alexwizp
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

alexwizp added a commit to alexwizp/kibana that referenced this pull request Jul 24, 2025
… ESLint rule (Step 2) (elastic#227821)

> \[!CAUTION]
> ⚠️ Changes were made by GenAI. Please review carefully.

## Summary

This PR applies the auto-fix for the newly introduced
`@elastic/eui/require-aria-label-for-modals` rule. This rule ensures
that EUI modal components (`EuiModal` and `EuiFlyout`) include either an
`aria-label` or `aria-labelledby` prop to support screen reader
accessibility. These attributes help users understand the purpose and
content of modal dialogs.

## Changes Made

1. **Identified the modal title/header element** used within `EuiModal`
or `EuiFlyout`.
Common elements include: `EuiFlyoutTitle`, `EuiModalTitle`, `EuiTitle`,
`<h2>`, `<h3>`, or other heading tags.

2. **Ensured the title element has an `id`:**
If the header element lacked an `id`, one was programmatically
generated:

   * **For function components:**

* Imported `useGeneratedHtmlId` from `@elastic/eui` if not already
present:

       ```ts
       import { useGeneratedHtmlId } from '@elastic/eui';
       ```
     * Defined a unique ID before the `return` statement:

       ```ts
       const modalTitleId = useGeneratedHtmlId();
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

   * **For class components:**

* Imported `htmlIdGenerator` from `@elastic/eui` if not already present:

       ```ts
       import { htmlIdGenerator } from '@elastic/eui';
       ```
     * Defined a unique ID within the `render()` method:

       ```ts
       const modalTitleId = htmlIdGenerator()('modalTitle');
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

3. **Updated the `EuiModal` or `EuiFlyout` component** to include the
`aria-labelledby` attribute referencing the generated title ID:

   ```tsx
   <EuiModal aria-labelledby={modalTitleId} />
   ```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit a3b63e3)

# Conflicts:
#	x-pack/platform/plugins/private/index_lifecycle_management/public/extend_index_management/components/add_lifecycle_confirm_modal.tsx
#	x-pack/platform/plugins/shared/ml/public/application/components/model_snapshots/revert_model_snapshot_flyout/revert_model_snapshot_flyout.tsx
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
… ESLint rule (Step 2) (elastic#227821)

> \[!CAUTION]
> ⚠️ Changes were made by GenAI. Please review carefully.

## Summary

This PR applies the auto-fix for the newly introduced
`@elastic/eui/require-aria-label-for-modals` rule. This rule ensures
that EUI modal components (`EuiModal` and `EuiFlyout`) include either an
`aria-label` or `aria-labelledby` prop to support screen reader
accessibility. These attributes help users understand the purpose and
content of modal dialogs.

## Changes Made

1. **Identified the modal title/header element** used within `EuiModal`
or `EuiFlyout`.
Common elements include: `EuiFlyoutTitle`, `EuiModalTitle`, `EuiTitle`,
`<h2>`, `<h3>`, or other heading tags.

2. **Ensured the title element has an `id`:**
If the header element lacked an `id`, one was programmatically
generated:

   * **For function components:**

* Imported `useGeneratedHtmlId` from `@elastic/eui` if not already
present:

       ```ts
       import { useGeneratedHtmlId } from '@elastic/eui';
       ```
     * Defined a unique ID before the `return` statement:

       ```ts
       const modalTitleId = useGeneratedHtmlId();
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

   * **For class components:**

* Imported `htmlIdGenerator` from `@elastic/eui` if not already present:

       ```ts
       import { htmlIdGenerator } from '@elastic/eui';
       ```
     * Defined a unique ID within the `render()` method:

       ```ts
       const modalTitleId = htmlIdGenerator()('modalTitle');
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

3. **Updated the `EuiModal` or `EuiFlyout` component** to include the
`aria-labelledby` attribute referencing the generated title ID:

   ```tsx
   <EuiModal aria-labelledby={modalTitleId} />
   ```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jul 25, 2025
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @alexwizp

alexwizp added a commit that referenced this pull request Jul 28, 2025
…modals ESLint rule (Step 2) (#227821) (#229342)

# Backport

This will backport the following commits from `main` to `9.1`:
- [Auto-fix violations of the @elastic/eui/require-aria-label-for-modals
ESLint rule (Step 2)
(#227821)](#227821)

<!--- Backport version: 10.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Alexey
Antonov","email":"alexwizp@gmail.com"},"sourceCommit":{"committedDate":"2025-07-24T15:06:05Z","message":"Auto-fix
violations of the @elastic/eui/require-aria-label-for-modals ESLint rule
(Step 2) (#227821)\n\n> \\[!CAUTION]\n> ⚠️ Changes were made by GenAI.
Please review carefully.\n\n## Summary\n\nThis PR applies the auto-fix
for the newly introduced\n`@elastic/eui/require-aria-label-for-modals`
rule. This rule ensures\nthat EUI modal components (`EuiModal` and
`EuiFlyout`) include either an\n`aria-label` or `aria-labelledby` prop
to support screen reader\naccessibility. These attributes help users
understand the purpose and\ncontent of modal dialogs.\n\n## Changes
Made\n\n1. **Identified the modal title/header element** used within
`EuiModal`\nor `EuiFlyout`.\nCommon elements include: `EuiFlyoutTitle`,
`EuiModalTitle`, `EuiTitle`,\n`<h2>`, `<h3>`, or other heading
tags.\n\n2. **Ensured the title element has an `id`:**\nIf the header
element lacked an `id`, one was programmatically\ngenerated:\n\n * **For
function components:**\n\n* Imported `useGeneratedHtmlId` from
`@elastic/eui` if not already\npresent:\n\n ```ts\n import {
useGeneratedHtmlId } from '@elastic/eui';\n ```\n * Defined a unique ID
before the `return` statement:\n\n ```ts\n const modalTitleId =
useGeneratedHtmlId();\n ```\n * Applied the ID to the title element:\n\n
```tsx\n <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>\n
```\n\n * **For class components:**\n\n* Imported `htmlIdGenerator` from
`@elastic/eui` if not already present:\n\n ```ts\n import {
htmlIdGenerator } from '@elastic/eui';\n ```\n * Defined a unique ID
within the `render()` method:\n\n ```ts\n const modalTitleId =
htmlIdGenerator()('modalTitle');\n ```\n * Applied the ID to the title
element:\n\n ```tsx\n <EuiModalTitle
id={modalTitleId}>Title</EuiModalTitle>\n ```\n\n3. **Updated the
`EuiModal` or `EuiFlyout` component** to include the\n`aria-labelledby`
attribute referencing the generated title ID:\n\n ```tsx\n <EuiModal
aria-labelledby={modalTitleId} />\n ```\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"a3b63e3718a6852a2c8ee750245b81a6f745ed5e","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Project:Accessibility","release_note:skip","Team:Fleet","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services","Team:obs-ux-management","v9.2.0"],"title":"Auto-fix
violations of the @elastic/eui/require-aria-label-for-modals ESLint rule
(Step
2)","number":227821,"url":"https://github.com/elastic/kibana/pull/227821","mergeCommit":{"message":"Auto-fix
violations of the @elastic/eui/require-aria-label-for-modals ESLint rule
(Step 2) (#227821)\n\n> \\[!CAUTION]\n> ⚠️ Changes were made by GenAI.
Please review carefully.\n\n## Summary\n\nThis PR applies the auto-fix
for the newly introduced\n`@elastic/eui/require-aria-label-for-modals`
rule. This rule ensures\nthat EUI modal components (`EuiModal` and
`EuiFlyout`) include either an\n`aria-label` or `aria-labelledby` prop
to support screen reader\naccessibility. These attributes help users
understand the purpose and\ncontent of modal dialogs.\n\n## Changes
Made\n\n1. **Identified the modal title/header element** used within
`EuiModal`\nor `EuiFlyout`.\nCommon elements include: `EuiFlyoutTitle`,
`EuiModalTitle`, `EuiTitle`,\n`<h2>`, `<h3>`, or other heading
tags.\n\n2. **Ensured the title element has an `id`:**\nIf the header
element lacked an `id`, one was programmatically\ngenerated:\n\n * **For
function components:**\n\n* Imported `useGeneratedHtmlId` from
`@elastic/eui` if not already\npresent:\n\n ```ts\n import {
useGeneratedHtmlId } from '@elastic/eui';\n ```\n * Defined a unique ID
before the `return` statement:\n\n ```ts\n const modalTitleId =
useGeneratedHtmlId();\n ```\n * Applied the ID to the title element:\n\n
```tsx\n <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>\n
```\n\n * **For class components:**\n\n* Imported `htmlIdGenerator` from
`@elastic/eui` if not already present:\n\n ```ts\n import {
htmlIdGenerator } from '@elastic/eui';\n ```\n * Defined a unique ID
within the `render()` method:\n\n ```ts\n const modalTitleId =
htmlIdGenerator()('modalTitle');\n ```\n * Applied the ID to the title
element:\n\n ```tsx\n <EuiModalTitle
id={modalTitleId}>Title</EuiModalTitle>\n ```\n\n3. **Updated the
`EuiModal` or `EuiFlyout` component** to include the\n`aria-labelledby`
attribute referencing the generated title ID:\n\n ```tsx\n <EuiModal
aria-labelledby={modalTitleId} />\n ```\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"a3b63e3718a6852a2c8ee750245b81a6f745ed5e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227821","number":227821,"mergeCommit":{"message":"Auto-fix
violations of the @elastic/eui/require-aria-label-for-modals ESLint rule
(Step 2) (#227821)\n\n> \\[!CAUTION]\n> ⚠️ Changes were made by GenAI.
Please review carefully.\n\n## Summary\n\nThis PR applies the auto-fix
for the newly introduced\n`@elastic/eui/require-aria-label-for-modals`
rule. This rule ensures\nthat EUI modal components (`EuiModal` and
`EuiFlyout`) include either an\n`aria-label` or `aria-labelledby` prop
to support screen reader\naccessibility. These attributes help users
understand the purpose and\ncontent of modal dialogs.\n\n## Changes
Made\n\n1. **Identified the modal title/header element** used within
`EuiModal`\nor `EuiFlyout`.\nCommon elements include: `EuiFlyoutTitle`,
`EuiModalTitle`, `EuiTitle`,\n`<h2>`, `<h3>`, or other heading
tags.\n\n2. **Ensured the title element has an `id`:**\nIf the header
element lacked an `id`, one was programmatically\ngenerated:\n\n * **For
function components:**\n\n* Imported `useGeneratedHtmlId` from
`@elastic/eui` if not already\npresent:\n\n ```ts\n import {
useGeneratedHtmlId } from '@elastic/eui';\n ```\n * Defined a unique ID
before the `return` statement:\n\n ```ts\n const modalTitleId =
useGeneratedHtmlId();\n ```\n * Applied the ID to the title element:\n\n
```tsx\n <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>\n
```\n\n * **For class components:**\n\n* Imported `htmlIdGenerator` from
`@elastic/eui` if not already present:\n\n ```ts\n import {
htmlIdGenerator } from '@elastic/eui';\n ```\n * Defined a unique ID
within the `render()` method:\n\n ```ts\n const modalTitleId =
htmlIdGenerator()('modalTitle');\n ```\n * Applied the ID to the title
element:\n\n ```tsx\n <EuiModalTitle
id={modalTitleId}>Title</EuiModalTitle>\n ```\n\n3. **Updated the
`EuiModal` or `EuiFlyout` component** to include the\n`aria-labelledby`
attribute referencing the generated title ID:\n\n ```tsx\n <EuiModal
aria-labelledby={modalTitleId} />\n ```\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"a3b63e3718a6852a2c8ee750245b81a6f745ed5e"}}]}]
BACKPORT-->
@kibanamachine kibanamachine added v9.1.0 and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Jul 28, 2025
@mistic mistic added v9.1.1 and removed v9.1.0 labels Jul 29, 2025
eokoneyo pushed a commit to eokoneyo/kibana that referenced this pull request Jul 31, 2025
… ESLint rule (Step 2) (elastic#227821)

> \[!CAUTION]
> ⚠️ Changes were made by GenAI. Please review carefully.

## Summary

This PR applies the auto-fix for the newly introduced
`@elastic/eui/require-aria-label-for-modals` rule. This rule ensures
that EUI modal components (`EuiModal` and `EuiFlyout`) include either an
`aria-label` or `aria-labelledby` prop to support screen reader
accessibility. These attributes help users understand the purpose and
content of modal dialogs.

## Changes Made

1. **Identified the modal title/header element** used within `EuiModal`
or `EuiFlyout`.
Common elements include: `EuiFlyoutTitle`, `EuiModalTitle`, `EuiTitle`,
`<h2>`, `<h3>`, or other heading tags.

2. **Ensured the title element has an `id`:**
If the header element lacked an `id`, one was programmatically
generated:

   * **For function components:**

* Imported `useGeneratedHtmlId` from `@elastic/eui` if not already
present:

       ```ts
       import { useGeneratedHtmlId } from '@elastic/eui';
       ```
     * Defined a unique ID before the `return` statement:

       ```ts
       const modalTitleId = useGeneratedHtmlId();
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

   * **For class components:**

* Imported `htmlIdGenerator` from `@elastic/eui` if not already present:

       ```ts
       import { htmlIdGenerator } from '@elastic/eui';
       ```
     * Defined a unique ID within the `render()` method:

       ```ts
       const modalTitleId = htmlIdGenerator()('modalTitle');
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

3. **Updated the `EuiModal` or `EuiFlyout` component** to include the
`aria-labelledby` attribute referencing the generated title ID:

   ```tsx
   <EuiModal aria-labelledby={modalTitleId} />
   ```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
alexwizp added a commit that referenced this pull request Aug 4, 2025
…nt rule (Step 3) (#229616)

## Summary

This PR manually fixes some remaining violations of the following rule
that, for some reason, were not addressed in the previous PR:
#227821

It applies the auto-fix for the newly introduced
`@elastic/eui/require-aria-label-for-modals` rule. This rule ensures
that `EUI` modal components (`EuiModal` and `EuiFlyout`) include either
an aria-label or `aria-labelledby` prop to support screen reader
accessibility. These attributes help users understand the purpose and
content of modal dialogs.

## Changes Made

1. **Identified the modal title/header element** used within `EuiModal`
or `EuiFlyout`.
Common elements include: `EuiFlyoutTitle`, `EuiModalTitle`, `EuiTitle`,
`<h2>`, `<h3>`, or other heading tags.

2. **Ensured the title element has an `id`:**
If the header element lacked an `id`, one was programmatically
generated:

   * **For function components:**

* Imported `useGeneratedHtmlId` from `@elastic/eui` if not already
present:

       ```ts
       import { useGeneratedHtmlId } from '@elastic/eui';
       ```
     * Defined a unique ID before the `return` statement:

       ```ts
       const modalTitleId = useGeneratedHtmlId();
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

   * **For class components:**

* Imported `htmlIdGenerator` from `@elastic/eui` if not already present:

       ```ts
       import { htmlIdGenerator } from '@elastic/eui';
       ```
     * Defined a unique ID within the `render()` method:

       ```ts
       const modalTitleId = htmlIdGenerator()('modalTitle');
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

3. **Updated the `EuiModal` or `EuiFlyout` component** to include the
`aria-labelledby` attribute referencing the generated title ID:

   ```tsx
   <EuiModal aria-labelledby={modalTitleId} />
   ```

<!--ONMERGE {"backportTargets":["9.1"]} ONMERGE-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
alexwizp added a commit to alexwizp/kibana that referenced this pull request Aug 4, 2025
…nt rule (Step 3) (elastic#229616)

## Summary

This PR manually fixes some remaining violations of the following rule
that, for some reason, were not addressed in the previous PR:
elastic#227821

It applies the auto-fix for the newly introduced
`@elastic/eui/require-aria-label-for-modals` rule. This rule ensures
that `EUI` modal components (`EuiModal` and `EuiFlyout`) include either
an aria-label or `aria-labelledby` prop to support screen reader
accessibility. These attributes help users understand the purpose and
content of modal dialogs.

## Changes Made

1. **Identified the modal title/header element** used within `EuiModal`
or `EuiFlyout`.
Common elements include: `EuiFlyoutTitle`, `EuiModalTitle`, `EuiTitle`,
`<h2>`, `<h3>`, or other heading tags.

2. **Ensured the title element has an `id`:**
If the header element lacked an `id`, one was programmatically
generated:

   * **For function components:**

* Imported `useGeneratedHtmlId` from `@elastic/eui` if not already
present:

       ```ts
       import { useGeneratedHtmlId } from '@elastic/eui';
       ```
     * Defined a unique ID before the `return` statement:

       ```ts
       const modalTitleId = useGeneratedHtmlId();
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

   * **For class components:**

* Imported `htmlIdGenerator` from `@elastic/eui` if not already present:

       ```ts
       import { htmlIdGenerator } from '@elastic/eui';
       ```
     * Defined a unique ID within the `render()` method:

       ```ts
       const modalTitleId = htmlIdGenerator()('modalTitle');
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

3. **Updated the `EuiModal` or `EuiFlyout` component** to include the
`aria-labelledby` attribute referencing the generated title ID:

   ```tsx
   <EuiModal aria-labelledby={modalTitleId} />
   ```

<!--ONMERGE {"backportTargets":["9.1"]} ONMERGE-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit ef05e61)

# Conflicts:
#	src/platform/plugins/shared/workflows_management/public/features/run_workflow/ui/test_workflow_modal.tsx
#	src/platform/plugins/shared/workflows_management/public/features/run_workflow/ui/workflow_event_modal.tsx
alexwizp added a commit that referenced this pull request Aug 4, 2025
…s ESLint rule (Step 3) (#229616) (#230417)

# Backport

This will backport the following commits from `main` to `9.1`:
- [Fix violations of the @elastic/eui/require-aria-label-for-modals
ESLint rule (Step 3)
(#229616)](#229616)

<!--- Backport version: 10.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Alexey
Antonov","email":"alexwizp@gmail.com"},"sourceCommit":{"committedDate":"2025-08-04T12:18:33Z","message":"Fix
violations of the @elastic/eui/require-aria-label-for-modals ESLint rule
(Step 3) (#229616)\n\n## Summary\n\nThis PR manually fixes some
remaining violations of the following rule\nthat, for some reason, were
not addressed in the previous
PR:\nhttps://github.com//pull/227821\n\nIt applies the
auto-fix for the newly
introduced\n`@elastic/eui/require-aria-label-for-modals` rule. This rule
ensures\nthat `EUI` modal components (`EuiModal` and `EuiFlyout`)
include either\nan aria-label or `aria-labelledby` prop to support
screen reader\naccessibility. These attributes help users understand the
purpose and\ncontent of modal dialogs.\n\n## Changes Made\n\n1.
**Identified the modal title/header element** used within `EuiModal`\nor
`EuiFlyout`.\nCommon elements include: `EuiFlyoutTitle`,
`EuiModalTitle`, `EuiTitle`,\n`<h2>`, `<h3>`, or other heading
tags.\n\n2. **Ensured the title element has an `id`:**\nIf the header
element lacked an `id`, one was programmatically\ngenerated:\n\n * **For
function components:**\n\n* Imported `useGeneratedHtmlId` from
`@elastic/eui` if not already\npresent:\n\n ```ts\n import {
useGeneratedHtmlId } from '@elastic/eui';\n ```\n * Defined a unique ID
before the `return` statement:\n\n ```ts\n const modalTitleId =
useGeneratedHtmlId();\n ```\n * Applied the ID to the title element:\n\n
```tsx\n <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>\n
```\n\n * **For class components:**\n\n* Imported `htmlIdGenerator` from
`@elastic/eui` if not already present:\n\n ```ts\n import {
htmlIdGenerator } from '@elastic/eui';\n ```\n * Defined a unique ID
within the `render()` method:\n\n ```ts\n const modalTitleId =
htmlIdGenerator()('modalTitle');\n ```\n * Applied the ID to the title
element:\n\n ```tsx\n <EuiModalTitle
id={modalTitleId}>Title</EuiModalTitle>\n ```\n\n3. **Updated the
`EuiModal` or `EuiFlyout` component** to include the\n`aria-labelledby`
attribute referencing the generated title ID:\n\n ```tsx\n <EuiModal
aria-labelledby={modalTitleId} />\n
```\n\n\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"ef05e61a64ff49080636578a37d6502492f9c947","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Project:Accessibility","release_note:skip","Team:Fleet","backport:prev-minor","ci:project-deploy-observability","v9.2.0"],"title":"Fix
violations of the @elastic/eui/require-aria-label-for-modals ESLint rule
(Step
3)","number":229616,"url":"https://github.com/elastic/kibana/pull/229616","mergeCommit":{"message":"Fix
violations of the @elastic/eui/require-aria-label-for-modals ESLint rule
(Step 3) (#229616)\n\n## Summary\n\nThis PR manually fixes some
remaining violations of the following rule\nthat, for some reason, were
not addressed in the previous
PR:\nhttps://github.com//pull/227821\n\nIt applies the
auto-fix for the newly
introduced\n`@elastic/eui/require-aria-label-for-modals` rule. This rule
ensures\nthat `EUI` modal components (`EuiModal` and `EuiFlyout`)
include either\nan aria-label or `aria-labelledby` prop to support
screen reader\naccessibility. These attributes help users understand the
purpose and\ncontent of modal dialogs.\n\n## Changes Made\n\n1.
**Identified the modal title/header element** used within `EuiModal`\nor
`EuiFlyout`.\nCommon elements include: `EuiFlyoutTitle`,
`EuiModalTitle`, `EuiTitle`,\n`<h2>`, `<h3>`, or other heading
tags.\n\n2. **Ensured the title element has an `id`:**\nIf the header
element lacked an `id`, one was programmatically\ngenerated:\n\n * **For
function components:**\n\n* Imported `useGeneratedHtmlId` from
`@elastic/eui` if not already\npresent:\n\n ```ts\n import {
useGeneratedHtmlId } from '@elastic/eui';\n ```\n * Defined a unique ID
before the `return` statement:\n\n ```ts\n const modalTitleId =
useGeneratedHtmlId();\n ```\n * Applied the ID to the title element:\n\n
```tsx\n <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>\n
```\n\n * **For class components:**\n\n* Imported `htmlIdGenerator` from
`@elastic/eui` if not already present:\n\n ```ts\n import {
htmlIdGenerator } from '@elastic/eui';\n ```\n * Defined a unique ID
within the `render()` method:\n\n ```ts\n const modalTitleId =
htmlIdGenerator()('modalTitle');\n ```\n * Applied the ID to the title
element:\n\n ```tsx\n <EuiModalTitle
id={modalTitleId}>Title</EuiModalTitle>\n ```\n\n3. **Updated the
`EuiModal` or `EuiFlyout` component** to include the\n`aria-labelledby`
attribute referencing the generated title ID:\n\n ```tsx\n <EuiModal
aria-labelledby={modalTitleId} />\n
```\n\n\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"ef05e61a64ff49080636578a37d6502492f9c947"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/229616","number":229616,"mergeCommit":{"message":"Fix
violations of the @elastic/eui/require-aria-label-for-modals ESLint rule
(Step 3) (#229616)\n\n## Summary\n\nThis PR manually fixes some
remaining violations of the following rule\nthat, for some reason, were
not addressed in the previous
PR:\nhttps://github.com//pull/227821\n\nIt applies the
auto-fix for the newly
introduced\n`@elastic/eui/require-aria-label-for-modals` rule. This rule
ensures\nthat `EUI` modal components (`EuiModal` and `EuiFlyout`)
include either\nan aria-label or `aria-labelledby` prop to support
screen reader\naccessibility. These attributes help users understand the
purpose and\ncontent of modal dialogs.\n\n## Changes Made\n\n1.
**Identified the modal title/header element** used within `EuiModal`\nor
`EuiFlyout`.\nCommon elements include: `EuiFlyoutTitle`,
`EuiModalTitle`, `EuiTitle`,\n`<h2>`, `<h3>`, or other heading
tags.\n\n2. **Ensured the title element has an `id`:**\nIf the header
element lacked an `id`, one was programmatically\ngenerated:\n\n * **For
function components:**\n\n* Imported `useGeneratedHtmlId` from
`@elastic/eui` if not already\npresent:\n\n ```ts\n import {
useGeneratedHtmlId } from '@elastic/eui';\n ```\n * Defined a unique ID
before the `return` statement:\n\n ```ts\n const modalTitleId =
useGeneratedHtmlId();\n ```\n * Applied the ID to the title element:\n\n
```tsx\n <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>\n
```\n\n * **For class components:**\n\n* Imported `htmlIdGenerator` from
`@elastic/eui` if not already present:\n\n ```ts\n import {
htmlIdGenerator } from '@elastic/eui';\n ```\n * Defined a unique ID
within the `render()` method:\n\n ```ts\n const modalTitleId =
htmlIdGenerator()('modalTitle');\n ```\n * Applied the ID to the title
element:\n\n ```tsx\n <EuiModalTitle
id={modalTitleId}>Title</EuiModalTitle>\n ```\n\n3. **Updated the
`EuiModal` or `EuiFlyout` component** to include the\n`aria-labelledby`
attribute referencing the generated title ID:\n\n ```tsx\n <EuiModal
aria-labelledby={modalTitleId} />\n
```\n\n\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"ef05e61a64ff49080636578a37d6502492f9c947"}}]}]
BACKPORT-->
szaffarano pushed a commit to szaffarano/kibana that referenced this pull request Aug 5, 2025
…nt rule (Step 3) (elastic#229616)

## Summary

This PR manually fixes some remaining violations of the following rule
that, for some reason, were not addressed in the previous PR:
elastic#227821

It applies the auto-fix for the newly introduced
`@elastic/eui/require-aria-label-for-modals` rule. This rule ensures
that `EUI` modal components (`EuiModal` and `EuiFlyout`) include either
an aria-label or `aria-labelledby` prop to support screen reader
accessibility. These attributes help users understand the purpose and
content of modal dialogs.

## Changes Made

1. **Identified the modal title/header element** used within `EuiModal`
or `EuiFlyout`.
Common elements include: `EuiFlyoutTitle`, `EuiModalTitle`, `EuiTitle`,
`<h2>`, `<h3>`, or other heading tags.

2. **Ensured the title element has an `id`:**
If the header element lacked an `id`, one was programmatically
generated:

   * **For function components:**

* Imported `useGeneratedHtmlId` from `@elastic/eui` if not already
present:

       ```ts
       import { useGeneratedHtmlId } from '@elastic/eui';
       ```
     * Defined a unique ID before the `return` statement:

       ```ts
       const modalTitleId = useGeneratedHtmlId();
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

   * **For class components:**

* Imported `htmlIdGenerator` from `@elastic/eui` if not already present:

       ```ts
       import { htmlIdGenerator } from '@elastic/eui';
       ```
     * Defined a unique ID within the `render()` method:

       ```ts
       const modalTitleId = htmlIdGenerator()('modalTitle');
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

3. **Updated the `EuiModal` or `EuiFlyout` component** to include the
`aria-labelledby` attribute referencing the generated title ID:

   ```tsx
   <EuiModal aria-labelledby={modalTitleId} />
   ```

<!--ONMERGE {"backportTargets":["9.1"]} ONMERGE-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
delanni pushed a commit to delanni/kibana that referenced this pull request Aug 5, 2025
… ESLint rule (Step 2) (elastic#227821)

> \[!CAUTION]
> ⚠️ Changes were made by GenAI. Please review carefully.

## Summary

This PR applies the auto-fix for the newly introduced
`@elastic/eui/require-aria-label-for-modals` rule. This rule ensures
that EUI modal components (`EuiModal` and `EuiFlyout`) include either an
`aria-label` or `aria-labelledby` prop to support screen reader
accessibility. These attributes help users understand the purpose and
content of modal dialogs.

## Changes Made

1. **Identified the modal title/header element** used within `EuiModal`
or `EuiFlyout`.
Common elements include: `EuiFlyoutTitle`, `EuiModalTitle`, `EuiTitle`,
`<h2>`, `<h3>`, or other heading tags.

2. **Ensured the title element has an `id`:**
If the header element lacked an `id`, one was programmatically
generated:

   * **For function components:**

* Imported `useGeneratedHtmlId` from `@elastic/eui` if not already
present:

       ```ts
       import { useGeneratedHtmlId } from '@elastic/eui';
       ```
     * Defined a unique ID before the `return` statement:

       ```ts
       const modalTitleId = useGeneratedHtmlId();
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

   * **For class components:**

* Imported `htmlIdGenerator` from `@elastic/eui` if not already present:

       ```ts
       import { htmlIdGenerator } from '@elastic/eui';
       ```
     * Defined a unique ID within the `render()` method:

       ```ts
       const modalTitleId = htmlIdGenerator()('modalTitle');
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

3. **Updated the `EuiModal` or `EuiFlyout` component** to include the
`aria-labelledby` attribute referencing the generated title ID:

   ```tsx
   <EuiModal aria-labelledby={modalTitleId} />
   ```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
delanni pushed a commit to delanni/kibana that referenced this pull request Aug 5, 2025
…nt rule (Step 3) (elastic#229616)

## Summary

This PR manually fixes some remaining violations of the following rule
that, for some reason, were not addressed in the previous PR:
elastic#227821

It applies the auto-fix for the newly introduced
`@elastic/eui/require-aria-label-for-modals` rule. This rule ensures
that `EUI` modal components (`EuiModal` and `EuiFlyout`) include either
an aria-label or `aria-labelledby` prop to support screen reader
accessibility. These attributes help users understand the purpose and
content of modal dialogs.

## Changes Made

1. **Identified the modal title/header element** used within `EuiModal`
or `EuiFlyout`.
Common elements include: `EuiFlyoutTitle`, `EuiModalTitle`, `EuiTitle`,
`<h2>`, `<h3>`, or other heading tags.

2. **Ensured the title element has an `id`:**
If the header element lacked an `id`, one was programmatically
generated:

   * **For function components:**

* Imported `useGeneratedHtmlId` from `@elastic/eui` if not already
present:

       ```ts
       import { useGeneratedHtmlId } from '@elastic/eui';
       ```
     * Defined a unique ID before the `return` statement:

       ```ts
       const modalTitleId = useGeneratedHtmlId();
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

   * **For class components:**

* Imported `htmlIdGenerator` from `@elastic/eui` if not already present:

       ```ts
       import { htmlIdGenerator } from '@elastic/eui';
       ```
     * Defined a unique ID within the `render()` method:

       ```ts
       const modalTitleId = htmlIdGenerator()('modalTitle');
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

3. **Updated the `EuiModal` or `EuiFlyout` component** to include the
`aria-labelledby` attribute referencing the generated title ID:

   ```tsx
   <EuiModal aria-labelledby={modalTitleId} />
   ```

<!--ONMERGE {"backportTargets":["9.1"]} ONMERGE-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
NicholasPeretti pushed a commit to NicholasPeretti/kibana that referenced this pull request Aug 18, 2025
…nt rule (Step 3) (elastic#229616)

## Summary

This PR manually fixes some remaining violations of the following rule
that, for some reason, were not addressed in the previous PR:
elastic#227821

It applies the auto-fix for the newly introduced
`@elastic/eui/require-aria-label-for-modals` rule. This rule ensures
that `EUI` modal components (`EuiModal` and `EuiFlyout`) include either
an aria-label or `aria-labelledby` prop to support screen reader
accessibility. These attributes help users understand the purpose and
content of modal dialogs.

## Changes Made

1. **Identified the modal title/header element** used within `EuiModal`
or `EuiFlyout`.
Common elements include: `EuiFlyoutTitle`, `EuiModalTitle`, `EuiTitle`,
`<h2>`, `<h3>`, or other heading tags.

2. **Ensured the title element has an `id`:**
If the header element lacked an `id`, one was programmatically
generated:

   * **For function components:**

* Imported `useGeneratedHtmlId` from `@elastic/eui` if not already
present:

       ```ts
       import { useGeneratedHtmlId } from '@elastic/eui';
       ```
     * Defined a unique ID before the `return` statement:

       ```ts
       const modalTitleId = useGeneratedHtmlId();
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

   * **For class components:**

* Imported `htmlIdGenerator` from `@elastic/eui` if not already present:

       ```ts
       import { htmlIdGenerator } from '@elastic/eui';
       ```
     * Defined a unique ID within the `render()` method:

       ```ts
       const modalTitleId = htmlIdGenerator()('modalTitle');
       ```
     * Applied the ID to the title element:

       ```tsx
       <EuiModalTitle id={modalTitleId}>Title</EuiModalTitle>
       ```

3. **Updated the `EuiModal` or `EuiFlyout` component** to include the
`aria-labelledby` attribute referencing the generated title ID:

   ```tsx
   <EuiModal aria-labelledby={modalTitleId} />
   ```

<!--ONMERGE {"backportTargets":["9.1"]} ONMERGE-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:project-deploy-observability Create an Observability project Project:Accessibility release_note:skip Skip the PR/issue when compiling release notes Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. Team:Fleet Team label for Observability Data Collection Fleet team Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. v9.1.1 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.