From cb8e1101e76cd5dbe64aaf8d1c50d7d13691b7e6 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Wed, 5 Jun 2024 08:58:58 +0900 Subject: [PATCH] Components: Fix inaccessible disabled `Button`s --- .eslintrc.js | 1 + packages/components/src/autocomplete/autocompleter-ui.tsx | 1 + packages/components/src/button/stories/e2e/index.story.tsx | 1 + packages/components/src/button/test/index.tsx | 6 ++++++ packages/components/src/combobox-control/index.tsx | 2 ++ packages/components/src/dropdown-menu/index.tsx | 1 + packages/components/src/form-token-field/token.tsx | 2 ++ 7 files changed, 14 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index 177f3cf35b8ccf..7d1bb161a7c3f1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -397,6 +397,7 @@ module.exports = { 'no-restricted-syntax': [ 'error', ...restrictedSyntax, + ...restrictedSyntaxComponents, { selector: ':matches(Literal[value=/--wp-admin-theme-/],TemplateElement[value.cooked=/--wp-admin-theme-/])', diff --git a/packages/components/src/autocomplete/autocompleter-ui.tsx b/packages/components/src/autocomplete/autocompleter-ui.tsx index a22e197decd154..59c88b4e41ecd1 100644 --- a/packages/components/src/autocomplete/autocompleter-ui.tsx +++ b/packages/components/src/autocomplete/autocompleter-ui.tsx @@ -58,6 +58,7 @@ function ListBox( { id={ `components-autocomplete-item-${ instanceId }-${ option.key }` } role="option" aria-selected={ index === selectedIndex } + __experimentalIsFocusable disabled={ option.isDisabled } className={ clsx( 'components-autocomplete__result', diff --git a/packages/components/src/button/stories/e2e/index.story.tsx b/packages/components/src/button/stories/e2e/index.story.tsx index 1baeb08fb73e23..075438fe0579eb 100644 --- a/packages/components/src/button/stories/e2e/index.story.tsx +++ b/packages/components/src/button/stories/e2e/index.story.tsx @@ -39,6 +39,7 @@ export const VariantStates: StoryFn< typeof Button > = ( key={ variant ?? 'undefined' } >