-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Revert "Revert "Properly handle buttons with aria-disabled
in focus helpers""
#7831
Revert "Revert "Properly handle buttons with aria-disabled
in focus helpers""
#7831
Conversation
size-limit report 📦
|
/snapit |
🫰✨ Thanks @acmertz! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/plugin-polaris@0.0.0-snapshot-release-20221201223726 yarn add @shopify/polaris@0.0.0-snapshot-release-20221201223726 |
/snapit |
🫰✨ Thanks @acmertz! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/plugin-polaris@0.0.0-snapshot-release-20221205180056 yarn add @shopify/polaris@0.0.0-snapshot-release-20221205180056 |
/snapit |
🫰✨ Thanks @acmertz! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/plugin-polaris@0.0.0-snapshot-release-20221205194321 yarn add @shopify/polaris@0.0.0-snapshot-release-20221205194321 |
/snapit |
🫰✨ Thanks @acmertz! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/plugin-polaris@0.0.0-snapshot-release-20221205223818 yarn add @shopify/polaris@0.0.0-snapshot-release-20221205223818 |
/snapit |
🫰✨ Thanks @acmertz! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/plugin-polaris@0.0.0-snapshot-release-20221207154429 yarn add @shopify/polaris@0.0.0-snapshot-release-20221207154429 |
f6ca5ed
to
733ef44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌🏽
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @shopify/polaris@10.18.0 ### Minor Changes - [#7992](#7992) [`e8f74f4cd`](e8f74f4) Thanks [@aveline](https://github.com/aveline)! - Added support for `outline` to `Box` ### Patch Changes - [#7988](#7988) [`382784f4e`](382784f) Thanks [@kyledurand](https://github.com/kyledurand)! - Reduced spacing on ChoiceList children - [#7899](#7899) [`930f077eb`](930f077) Thanks [@jeradg](https://github.com/jeradg)! - Fixed a bug where Tooltips nested in Scrollable containers sometimes don't update their positions correctly - [#7831](#7831) [`47487ee0c`](47487ee) Thanks [@acmertz](https://github.com/acmertz)! - Updated the focus helper functions to no longer treat buttons with `aria-disabled="true"` and `tabindex="-1" (but no`disabled\` attribute) as focusable. ## @shopify/plugin-polaris@0.0.25 ## polaris.shopify.com@0.28.2 ### Patch Changes - Updated dependencies \[[`382784f4e`](382784f), [`930f077eb`](930f077), [`47487ee0c`](47487ee), [`e8f74f4cd`](e8f74f4)]: - @shopify/polaris@10.18.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @shopify/polaris@10.18.0 ### Minor Changes - [Shopify#7992](Shopify#7992) [`e8f74f4cd`](Shopify@e8f74f4) Thanks [@aveline](https://github.com/aveline)! - Added support for `outline` to `Box` ### Patch Changes - [Shopify#7988](Shopify#7988) [`382784f4e`](Shopify@382784f) Thanks [@kyledurand](https://github.com/kyledurand)! - Reduced spacing on ChoiceList children - [Shopify#7899](Shopify#7899) [`930f077eb`](Shopify@930f077) Thanks [@jeradg](https://github.com/jeradg)! - Fixed a bug where Tooltips nested in Scrollable containers sometimes don't update their positions correctly - [Shopify#7831](Shopify#7831) [`47487ee0c`](Shopify@47487ee) Thanks [@acmertz](https://github.com/acmertz)! - Updated the focus helper functions to no longer treat buttons with `aria-disabled="true"` and `tabindex="-1" (but no`disabled\` attribute) as focusable. ## @shopify/plugin-polaris@0.0.25 ## polaris.shopify.com@0.28.2 ### Patch Changes - Updated dependencies \[[`382784f4e`](Shopify@382784f), [`930f077eb`](Shopify@930f077), [`47487ee0c`](Shopify@47487ee), [`e8f74f4cd`](Shopify@e8f74f4)]: - @shopify/polaris@10.18.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Reverts #7819, restoring the original change made in #7760 to fix #7728 - with a small tweak* to avoid a downstream accessibility issue caused by the original fix.
Please see the original PR (#7819) for more details on the issue being fixed.
*Investigation notes:
The first version of this change simply added `:not([tabindex="-1"])` to the affected CSS selector string in JS. It was updated to include `:not([aria-disabled])` based on [this review comment](https://github.com//pull/7760#discussion_r1026916700), but this ultimately caused some Storybook accessibility failures in CI in web and prompted the original change to be reverted.After creating a few snapshots with variations on this change, I narrowed down the issue to being caused by the addition of
:not([aria-disabled])
to theFOCUSABLE_SELECTOR
constant infocus.ts
:https://github.com/Shopify/polaris/blob/35ab232b5619b691fcfe4686d504b9b470836b2f/polaris-react/src/utilities/focus.ts#L8-L9
This caused failures like this to occur in web upon upgrading to the newest version of Polaris:
It appears that the test wasn't happy with some of the ARIA attributes being added to the affected
<div>
elements. Thearia-controls
,aria-owns
, andaria-expanded
attributes are applied in set-activator-attributes.ts by the Popover component, which calls the focusNextFocusableNode() helper in focus.ts.I wasn't able to find the exact reason why this caused the CI failures above, but my hypothesis right now is that the original change in #7819 caused a scenario wheresetActivatorAttributes()
could be called for an element which lacks arole
that allows it to usearia-controls
,aria-owns
, andaria-expanded
- but the way in which the<Popover>
manages its activator and wrapper elements with multiple refs,useEffect()
calls, and state variables makes this tricky to confirm (coupled with the fact that the CI failure occurred in another repository, of course).Update: The issue occurred because the selector in the original PR,
:not([aria-disabled])
, incorrectly excluded elements that hadaria-disabled="false"
. Changing the selector to:not([aria-disabled="true"])
fixes the Storybook accessibility failure that prompted the initial revert.How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx
:Playground.tsx
and runyarn dev
🎩 checklist
README.md
with documentation changes