Skip to content

Commit

Permalink
Update _disabled to use state selector (#6700)
Browse files Browse the repository at this point in the history
Co-authored-by: Segun Adebayo <joseshegs@gmail.com>
  • Loading branch information
sei0603 and segunadebayo committed Sep 16, 2022
1 parent f6002e4 commit 99329e4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions .changeset/new-dolls-trade.md
@@ -0,0 +1,8 @@
---
"@chakra-ui/styled-system": patch
"@chakra-ui/utils": patch
"@chakra-ui/dom-utils": patch
---

Update disabled selector to use state selector `:disabled`, instead of `[disabled]` attribute selector.
This is useful when an editable element is wrapped within `<fieldset disabled>`
2 changes: 1 addition & 1 deletion packages/components/styled-system/src/pseudos.ts
Expand Up @@ -68,7 +68,7 @@ export const pseudoSelectors = {
* - `&:disabled`
* - `&[data-disabled]`
*/
_disabled: "&[disabled], &[aria-disabled=true], &[data-disabled]",
_disabled: "&:disabled, &[aria-disabled=true], &[data-disabled]",
/**
* Styles for CSS Selector `&:readonly`
*/
Expand Down
8 changes: 4 additions & 4 deletions packages/legacy/utils/src/dom-query.ts
Expand Up @@ -2,15 +2,15 @@ import { isHTMLElement } from "./dom"
import { isFocusable, isTabbable } from "./tabbable"

const focusableElList = [
"input:not([disabled])",
"select:not([disabled])",
"textarea:not([disabled])",
"input:not(:disabled)",
"select:not(:disabled)",
"textarea:not(:disabled)",
"embed",
"iframe",
"object",
"a[href]",
"area[href]",
"button:not([disabled])",
"button:not(:disabled)",
"[tabindex]",
"audio[controls]",
"video[controls]",
Expand Down
8 changes: 4 additions & 4 deletions packages/utilities/dom-utils/src/index.ts
@@ -1,15 +1,15 @@
import { isFocusable, isTabbable } from "./tabbable"

const focusableElList = [
"input:not([disabled])",
"select:not([disabled])",
"textarea:not([disabled])",
"input:not(:disabled)",
"select:not(:disabled)",
"textarea:not(:disabled)",
"embed",
"iframe",
"object",
"a[href]",
"area[href]",
"button:not([disabled])",
"button:not(:disabled)",
"[tabindex]",
"audio[controls]",
"video[controls]",
Expand Down

1 comment on commit 99329e4

@vercel
Copy link

@vercel vercel bot commented on 99329e4 Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.