Skip to content

Commit d83c898

Browse files
feat(eslint): add EuiFlyoutResizable to @elastic/eui/require-aria-label-for-modals check (#8946)
Co-authored-by: Weronika Olejniczak <[email protected]>
1 parent fb461ac commit d83c898

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

packages/eslint-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ It's worth pointing out that although the examples provided are specific to EUI
129129

130130
### `@elastic/eui/require-aria-label-for-modals`
131131

132-
Ensures that EUI modal components (`EuiModal`, `EuiFlyout`, `EuiConfirmModal`) have either an `aria-label` or `aria-labelledby` prop for accessibility. This helps screen reader users understand the purpose and content of modal dialogs.
132+
Ensures that EUI modal components (`EuiModal`, `EuiFlyout`, `EuiFlyoutResizable` ,`EuiConfirmModal`) have either an `aria-label` or `aria-labelledby` prop for accessibility. This helps screen reader users understand the purpose and content of modal dialogs.
133133

134134
### `@elastic/eui/consistent-is-invalid-props`
135135

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Added `EuiFlyoutResizable` to `require-aria-label-for-modals` check

packages/eslint-plugin/src/rules/a11y/require_aria_label_for_modals.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ ruleTester.run('require-aria-label-for-modals', RequireAriaLabelForModals, {
5050
`,
5151
languageOptions,
5252
},
53+
{
54+
code: dedent`
55+
module.export = () => (
56+
<EuiFlyoutResizable aria-labelledby="modalTitleId" />
57+
)
58+
`,
59+
languageOptions,
60+
},
5361
{
5462
code: dedent`
5563
module.export = () => (
@@ -97,6 +105,20 @@ ruleTester.run('require-aria-label-for-modals', RequireAriaLabelForModals, {
97105
},
98106
],
99107
},
108+
{
109+
code: dedent`
110+
module.export = () => (
111+
<EuiFlyoutResizable title="Some title" />
112+
)
113+
`,
114+
languageOptions,
115+
errors: [
116+
{
117+
messageId: 'modalAriaMissing',
118+
data: { component: 'EuiFlyoutResizable' },
119+
},
120+
],
121+
},
100122
{
101123
code: dedent`
102124
module.export = () => (

packages/eslint-plugin/src/rules/a11y/require_aria_label_for_modals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import { TSESTree, ESLintUtils } from '@typescript-eslint/utils';
2121

22-
const modalComponents = ['EuiModal', 'EuiFlyout'];
22+
const modalComponents = ['EuiModal', 'EuiFlyout', 'EuiFlyoutResizable'];
2323
const confirmModalComponents = ['EuiConfirmModal'];
2424

2525
export const RequireAriaLabelForModals = ESLintUtils.RuleCreator.withoutDocs({

0 commit comments

Comments
 (0)