From 0e76c59c6a3850a0fb9fc514eb572926c399bf4f Mon Sep 17 00:00:00 2001 From: Aaron Mertzenich Date: Wed, 30 Nov 2022 16:43:12 -0600 Subject: [PATCH 1/3] Revert "Add `:not([aria-disabled])` to selector" This reverts commit 8bea76a179ac32641cbd40164cf182a14dc05c08. --- polaris-react/src/utilities/focus.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polaris-react/src/utilities/focus.ts b/polaris-react/src/utilities/focus.ts index b508619bc10..4fffd7abd41 100644 --- a/polaris-react/src/utilities/focus.ts +++ b/polaris-react/src/utilities/focus.ts @@ -6,9 +6,9 @@ export type MouseUpBlurHandler = ( ) => void; const FOCUSABLE_SELECTOR = - 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled):not([aria-disabled]):not([tabindex="-1"]),*[tabindex]'; + 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled):not([tabindex="-1"]),*[tabindex]'; const KEYBOARD_FOCUSABLE_SELECTORS = - 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled):not([aria-disabled]):not([tabindex="-1"]),*[tabindex]:not([tabindex="-1"])'; + 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled):not([tabindex="-1"]),*[tabindex]:not([tabindex="-1"])'; const MENUITEM_FOCUSABLE_SELECTORS = 'a[role="menuitem"],frame[role="menuitem"],iframe[role="menuitem"],input[role="menuitem"]:not([type=hidden]):not(:disabled),select[role="menuitem"]:not(:disabled),textarea[role="menuitem"]:not(:disabled),button[role="menuitem"]:not(:disabled),*[tabindex]:not([tabindex="-1"])'; export const handleMouseUpByBlurring: MouseUpBlurHandler = ({currentTarget}) => From 3633ca6c21c23d65dda428a29addc3d499de17cb Mon Sep 17 00:00:00 2001 From: Aaron Mertzenich Date: Wed, 30 Nov 2022 16:43:12 -0600 Subject: [PATCH 2/3] Revert "Update .changeset/gentle-cobras-punch.md" This reverts commit 9722739b6a14a22b28ca15a2828126864ccd0721. --- .changeset/gentle-cobras-punch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/gentle-cobras-punch.md b/.changeset/gentle-cobras-punch.md index af516b5a466..34c4687a88d 100644 --- a/.changeset/gentle-cobras-punch.md +++ b/.changeset/gentle-cobras-punch.md @@ -2,4 +2,4 @@ '@shopify/polaris': patch --- -Updated the focus helper functions to no longer treat buttons with `aria-disabled="disabled"` and `tabindex="-1" (but no`disabled` attribute) as focusable. +Updates the focus helper functions to no longer treat buttons with `aria-disabled="disabled"` and `tabindex="-1" (but no`disabled` attribute) as focusable. From 4e98f5cc65f37a9774d44f123232bc84544e32bd Mon Sep 17 00:00:00 2001 From: Aaron Mertzenich Date: Wed, 30 Nov 2022 16:43:12 -0600 Subject: [PATCH 3/3] Revert "Properly handle buttons with `aria-disabled` and `tabindex="-1"` in focus helpers Fixes #7728" This reverts commit 2827687632ac458e61ef1596d6bdf0c1e2414b51. --- .changeset/gentle-cobras-punch.md | 5 ----- polaris-react/src/utilities/focus.ts | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 .changeset/gentle-cobras-punch.md diff --git a/.changeset/gentle-cobras-punch.md b/.changeset/gentle-cobras-punch.md deleted file mode 100644 index 34c4687a88d..00000000000 --- a/.changeset/gentle-cobras-punch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/polaris': patch ---- - -Updates the focus helper functions to no longer treat buttons with `aria-disabled="disabled"` and `tabindex="-1" (but no`disabled` attribute) as focusable. diff --git a/polaris-react/src/utilities/focus.ts b/polaris-react/src/utilities/focus.ts index 4fffd7abd41..a2cb139b824 100644 --- a/polaris-react/src/utilities/focus.ts +++ b/polaris-react/src/utilities/focus.ts @@ -6,9 +6,9 @@ export type MouseUpBlurHandler = ( ) => void; const FOCUSABLE_SELECTOR = - 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled):not([tabindex="-1"]),*[tabindex]'; + 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]'; const KEYBOARD_FOCUSABLE_SELECTORS = - 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled):not([tabindex="-1"]),*[tabindex]:not([tabindex="-1"])'; + 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]:not([tabindex="-1"])'; const MENUITEM_FOCUSABLE_SELECTORS = 'a[role="menuitem"],frame[role="menuitem"],iframe[role="menuitem"],input[role="menuitem"]:not([type=hidden]):not(:disabled),select[role="menuitem"]:not(:disabled),textarea[role="menuitem"]:not(:disabled),button[role="menuitem"]:not(:disabled),*[tabindex]:not([tabindex="-1"])'; export const handleMouseUpByBlurring: MouseUpBlurHandler = ({currentTarget}) =>