-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Auto-fix violations of the @elastic/eui/require-aria-label-for-modals ESLint rule (Step 2) #227821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… ESLint rule (Step 2)
|
Starting backport for target branches: 9.1 https://github.com/elastic/kibana/actions/runs/16500615336 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
… 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
… 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>
|
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. |
…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-->
… 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>
…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>
…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
…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-->
…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>
… 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>
…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>
…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>
Caution
Summary
This PR applies the auto-fix for the newly introduced
@elastic/eui/require-aria-label-for-modalsrule. This rule ensures that EUI modal components (EuiModalandEuiFlyout) include either anaria-labeloraria-labelledbyprop to support screen reader accessibility. These attributes help users understand the purpose and content of modal dialogs.Changes Made
Identified the modal title/header element used within
EuiModalorEuiFlyout.Common elements include:
EuiFlyoutTitle,EuiModalTitle,EuiTitle,<h2>,<h3>, or other heading tags.Ensured the title element has an
id:If the header element lacked an
id, one was programmatically generated:For function components:
Imported
useGeneratedHtmlIdfrom@elastic/euiif not already present:Defined a unique ID before the
returnstatement:Applied the ID to the title element:
For class components:
Imported
htmlIdGeneratorfrom@elastic/euiif not already present:Defined a unique ID within the
render()method:Applied the ID to the title element:
Updated the
EuiModalorEuiFlyoutcomponent to include thearia-labelledbyattribute referencing the generated title ID: