Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/eslint-plugin/changelogs/upcoming/9436.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Updated `no-unnamed-interactive-element` to include checking `EuiColorPicker`
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ ruleTester.run('NoUnnamedInteractiveElement', NoUnnamedInteractiveElement, {
code: '<EuiBreadcrumbs aria-label="Breadcrumbs label" />',
languageOptions,
},
{
code: '<EuiColorPicker aria-label="ColorPicker label" />',
languageOptions,
},
// Wrapped in EuiFormRow with label
{
code: '<EuiFormRow label="Row label"><EuiComboBox /></EuiFormRow>',
Expand All @@ -53,6 +57,10 @@ ruleTester.run('NoUnnamedInteractiveElement', NoUnnamedInteractiveElement, {
code: '<EuiFormRow label="Row label"><EuiSelect /></EuiFormRow>',
languageOptions,
},
{
code: '<EuiFormRow label="Row label"><EuiColorPicker /></EuiFormRow>',
languageOptions,
},
],
invalid: [
// Missing a11y prop for interactive components
Expand Down Expand Up @@ -101,6 +109,11 @@ ruleTester.run('NoUnnamedInteractiveElement', NoUnnamedInteractiveElement, {
languageOptions,
errors: [{ messageId: 'missingA11y' }],
},
{
code: '<EuiColorPicker />',
languageOptions,
errors: [{ messageId: 'missingA11y' }],
},
// Wrapped but missing label
{
code: '<EuiFormRow><EuiComboBox /></EuiFormRow>',
Expand All @@ -112,5 +125,10 @@ ruleTester.run('NoUnnamedInteractiveElement', NoUnnamedInteractiveElement, {
languageOptions,
errors: [{ messageId: 'missingA11y' }],
},
{
code: '<EuiFormRow><EuiColorPicker /></EuiFormRow>',
languageOptions,
errors: [{ messageId: 'missingA11y' }],
},
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const interactiveComponents = [
'EuiPagination',
'EuiTreeView',
'EuiBreadcrumbs',
'EuiColorPicker',
] as const;

const wrappingComponents = ['EuiFormRow'] as const;
Expand Down Expand Up @@ -54,7 +55,10 @@ export const NoUnnamedInteractiveElement = ESLintUtils.RuleCreator.withoutDocs({
function report(opening: TSESTree.JSXOpeningElement) {
if (opening.name.type !== 'JSXIdentifier') return;
const component = opening.name.name;
const allowed = getAllowedA11yPropNamesForComponent(component, a11yConfig).join(', ');
const allowed = getAllowedA11yPropNamesForComponent(
component,
a11yConfig
).join(', ');
context.report({
node: opening,
messageId: 'missingA11y',
Expand Down
3 changes: 3 additions & 0 deletions packages/eui/changelogs/upcoming/9436.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Accessibility**

- Fixed `aria-label` not being applied to `EuiColorPicker`'s input element
Loading
Loading