-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: Accordion/Disclosure fixes from testing #7218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
snowystinger
left a comment
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.
nitpick on the test, otherwise looks good
tested in chrome
LFDanLu
left a comment
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.
Tested on Android and desktop, just two small comments
* docs: follow-up on accordion docs from testing * updates svgs for mobile, follow up from reviews * prevent outline on header on android * fix examples in useDisclosure on mobile * update focus visible * add focusProps to disclosure group example * use merge props
## API Changes
react-aria-components/react-aria-components:UNSTABLE_Disclosure-UNSTABLE_Disclosure {
- children?: ReactNode | ((DisclosureRenderProps & {
- defaultChildren: ReactNode | undefined
-})) => ReactNode
- className?: string | ((DisclosureRenderProps & {
- defaultClassName: string | undefined
-})) => string
- defaultExpanded?: boolean
- id?: Key
- isDisabled?: boolean
- isExpanded?: boolean
- onExpandedChange?: (boolean) => void
- slot?: string | null
- style?: CSSProperties | ((DisclosureRenderProps & {
- defaultStyle: CSSProperties
-})) => CSSProperties | undefined
-}/react-aria-components:UNSTABLE_DisclosureGroup-UNSTABLE_DisclosureGroup {
- allowsMultipleExpanded?: boolean
- children?: ReactNode | ((DisclosureGroupRenderProps & {
- defaultChildren: ReactNode | undefined
-})) => ReactNode
- className?: string | ((DisclosureGroupRenderProps & {
- defaultClassName: string | undefined
-})) => string
- defaultExpandedKeys?: Iterable<Key>
- expandedKeys?: Iterable<Key>
- id?: string
- isDisabled?: boolean
- onExpandedChange?: (Set<Key>) => any
- style?: CSSProperties | ((DisclosureGroupRenderProps & {
- defaultStyle: CSSProperties
-})) => CSSProperties | undefined
-}/react-aria-components:UNSTABLE_DisclosurePanel-UNSTABLE_DisclosurePanel {
- children: ReactNode
- className?: string | ((DisclosurePanelRenderProps & {
- defaultClassName: string | undefined
-})) => string
- id?: string
- role?: 'group' | 'region' = 'group'
- style?: CSSProperties | ((DisclosurePanelRenderProps & {
- defaultStyle: CSSProperties
-})) => CSSProperties | undefined
-}/react-aria-components:Disclosure+Disclosure {
+ children?: ReactNode | ((DisclosureRenderProps & {
+ defaultChildren: ReactNode | undefined
+})) => ReactNode
+ className?: string | ((DisclosureRenderProps & {
+ defaultClassName: string | undefined
+})) => string
+ defaultExpanded?: boolean
+ id?: Key
+ isDisabled?: boolean
+ isExpanded?: boolean
+ onExpandedChange?: (boolean) => void
+ slot?: string | null
+ style?: CSSProperties | ((DisclosureRenderProps & {
+ defaultStyle: CSSProperties
+})) => CSSProperties | undefined
+}/react-aria-components:DisclosureGroup+DisclosureGroup {
+ allowsMultipleExpanded?: boolean
+ children?: ReactNode | ((DisclosureGroupRenderProps & {
+ defaultChildren: ReactNode | undefined
+})) => ReactNode
+ className?: string | ((DisclosureGroupRenderProps & {
+ defaultClassName: string | undefined
+})) => string
+ defaultExpandedKeys?: Iterable<Key>
+ expandedKeys?: Iterable<Key>
+ id?: string
+ isDisabled?: boolean
+ onExpandedChange?: (Set<Key>) => any
+ style?: CSSProperties | ((DisclosureGroupRenderProps & {
+ defaultStyle: CSSProperties
+})) => CSSProperties | undefined
+}/react-aria-components:DisclosurePanel+DisclosurePanel {
+ children: ReactNode
+ className?: string | ((DisclosurePanelRenderProps & {
+ defaultClassName: string | undefined
+})) => string
+ id?: string
+ role?: 'group' | 'region' = 'group'
+ style?: CSSProperties | ((DisclosurePanelRenderProps & {
+ defaultStyle: CSSProperties
+})) => CSSProperties | undefined
+}@react-spectrum/accordion/@react-spectrum/accordion:Disclosure Disclosure {
+ UNSAFE_className?: string
+ UNSAFE_style?: CSSProperties
+ alignSelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'center' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'stretch'>
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
+ bottom?: Responsive<DimensionValue>
children: React.ReactNode
defaultExpanded?: boolean
+ end?: Responsive<DimensionValue>
+ flex?: Responsive<string | number | boolean>
+ flexBasis?: Responsive<number | string>
+ flexGrow?: Responsive<number>
+ flexShrink?: Responsive<number>
+ gridArea?: Responsive<string>
+ gridColumn?: Responsive<string>
+ gridColumnEnd?: Responsive<string>
+ gridColumnStart?: Responsive<string>
+ gridRow?: Responsive<string>
+ gridRowEnd?: Responsive<string>
+ gridRowStart?: Responsive<string>
+ height?: Responsive<DimensionValue>
id?: Key
isDisabled?: boolean
isExpanded?: boolean
+ isHidden?: Responsive<boolean>
isQuiet?: boolean
+ justifySelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'left' | 'right' | 'stretch'>
+ left?: Responsive<DimensionValue>
+ margin?: Responsive<DimensionValue>
+ marginBottom?: Responsive<DimensionValue>
+ marginEnd?: Responsive<DimensionValue>
+ marginStart?: Responsive<DimensionValue>
+ marginTop?: Responsive<DimensionValue>
+ marginX?: Responsive<DimensionValue>
+ marginY?: Responsive<DimensionValue>
+ maxHeight?: Responsive<DimensionValue>
+ maxWidth?: Responsive<DimensionValue>
+ minHeight?: Responsive<DimensionValue>
+ minWidth?: Responsive<DimensionValue>
onExpandedChange?: (boolean) => void
+ order?: Responsive<number>
+ position?: Responsive<'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'>
+ right?: Responsive<DimensionValue>
slot?: string | null
+ start?: Responsive<DimensionValue>
+ top?: Responsive<DimensionValue>
+ width?: Responsive<DimensionValue>
+ zIndex?: Responsive<number>
}/@react-spectrum/accordion:DisclosureHeader DisclosureHeader {
+ UNSAFE_className?: string
+ UNSAFE_style?: CSSProperties
+ alignSelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'center' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'stretch'>
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
+ bottom?: Responsive<DimensionValue>
children: React.ReactNode
+ end?: Responsive<DimensionValue>
+ flex?: Responsive<string | number | boolean>
+ flexBasis?: Responsive<number | string>
+ flexGrow?: Responsive<number>
+ flexShrink?: Responsive<number>
+ gridArea?: Responsive<string>
+ gridColumn?: Responsive<string>
+ gridColumnEnd?: Responsive<string>
+ gridColumnStart?: Responsive<string>
+ gridRow?: Responsive<string>
+ gridRowEnd?: Responsive<string>
+ gridRowStart?: Responsive<string>
+ height?: Responsive<DimensionValue>
id?: string
+ isHidden?: Responsive<boolean>
+ justifySelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'left' | 'right' | 'stretch'>
+ left?: Responsive<DimensionValue>
level?: number = 3
+ margin?: Responsive<DimensionValue>
+ marginBottom?: Responsive<DimensionValue>
+ marginEnd?: Responsive<DimensionValue>
+ marginStart?: Responsive<DimensionValue>
+ marginTop?: Responsive<DimensionValue>
+ marginX?: Responsive<DimensionValue>
+ marginY?: Responsive<DimensionValue>
+ maxHeight?: Responsive<DimensionValue>
+ maxWidth?: Responsive<DimensionValue>
+ minHeight?: Responsive<DimensionValue>
+ minWidth?: Responsive<DimensionValue>
+ order?: Responsive<number>
+ position?: Responsive<'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'>
+ right?: Responsive<DimensionValue>
+ start?: Responsive<DimensionValue>
+ top?: Responsive<DimensionValue>
+ width?: Responsive<DimensionValue>
+ zIndex?: Responsive<number>
}/@react-spectrum/accordion:DisclosurePanel DisclosurePanel {
+ UNSAFE_className?: string
+ UNSAFE_style?: CSSProperties
+ alignSelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'center' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'stretch'>
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
+ bottom?: Responsive<DimensionValue>
children: React.ReactNode
+ end?: Responsive<DimensionValue>
+ flex?: Responsive<string | number | boolean>
+ flexBasis?: Responsive<number | string>
+ flexGrow?: Responsive<number>
+ flexShrink?: Responsive<number>
+ gridArea?: Responsive<string>
+ gridColumn?: Responsive<string>
+ gridColumnEnd?: Responsive<string>
+ gridColumnStart?: Responsive<string>
+ gridRow?: Responsive<string>
+ gridRowEnd?: Responsive<string>
+ gridRowStart?: Responsive<string>
+ height?: Responsive<DimensionValue>
id?: string
+ isHidden?: Responsive<boolean>
+ justifySelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'left' | 'right' | 'stretch'>
+ left?: Responsive<DimensionValue>
+ margin?: Responsive<DimensionValue>
+ marginBottom?: Responsive<DimensionValue>
+ marginEnd?: Responsive<DimensionValue>
+ marginStart?: Responsive<DimensionValue>
+ marginTop?: Responsive<DimensionValue>
+ marginX?: Responsive<DimensionValue>
+ marginY?: Responsive<DimensionValue>
+ maxHeight?: Responsive<DimensionValue>
+ maxWidth?: Responsive<DimensionValue>
+ minHeight?: Responsive<DimensionValue>
+ minWidth?: Responsive<DimensionValue>
+ order?: Responsive<number>
+ position?: Responsive<'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'>
+ right?: Responsive<DimensionValue>
role?: 'group' | 'region' = 'group'
+ start?: Responsive<DimensionValue>
+ top?: Responsive<DimensionValue>
+ width?: Responsive<DimensionValue>
+ zIndex?: Responsive<number>
}/@react-spectrum/accordion:SpectrumDisclosureProps SpectrumDisclosureProps {
+ UNSAFE_className?: string
+ UNSAFE_style?: CSSProperties
+ alignSelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'center' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'stretch'>
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
+ bottom?: Responsive<DimensionValue>
children: React.ReactNode
defaultExpanded?: boolean
+ end?: Responsive<DimensionValue>
+ flex?: Responsive<string | number | boolean>
+ flexBasis?: Responsive<number | string>
+ flexGrow?: Responsive<number>
+ flexShrink?: Responsive<number>
+ gridArea?: Responsive<string>
+ gridColumn?: Responsive<string>
+ gridColumnEnd?: Responsive<string>
+ gridColumnStart?: Responsive<string>
+ gridRow?: Responsive<string>
+ gridRowEnd?: Responsive<string>
+ gridRowStart?: Responsive<string>
+ height?: Responsive<DimensionValue>
id?: Key
isDisabled?: boolean
isExpanded?: boolean
+ isHidden?: Responsive<boolean>
isQuiet?: boolean
+ justifySelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'left' | 'right' | 'stretch'>
+ left?: Responsive<DimensionValue>
+ margin?: Responsive<DimensionValue>
+ marginBottom?: Responsive<DimensionValue>
+ marginEnd?: Responsive<DimensionValue>
+ marginStart?: Responsive<DimensionValue>
+ marginTop?: Responsive<DimensionValue>
+ marginX?: Responsive<DimensionValue>
+ marginY?: Responsive<DimensionValue>
+ maxHeight?: Responsive<DimensionValue>
+ maxWidth?: Responsive<DimensionValue>
+ minHeight?: Responsive<DimensionValue>
+ minWidth?: Responsive<DimensionValue>
onExpandedChange?: (boolean) => void
+ order?: Responsive<number>
+ position?: Responsive<'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'>
+ right?: Responsive<DimensionValue>
slot?: string | null
+ start?: Responsive<DimensionValue>
+ top?: Responsive<DimensionValue>
+ width?: Responsive<DimensionValue>
+ zIndex?: Responsive<number>
}/@react-spectrum/accordion:SpectrumDisclosurePanelProps SpectrumDisclosurePanelProps {
+ UNSAFE_className?: string
+ UNSAFE_style?: CSSProperties
+ alignSelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'center' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'stretch'>
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
+ bottom?: Responsive<DimensionValue>
children: React.ReactNode
+ end?: Responsive<DimensionValue>
+ flex?: Responsive<string | number | boolean>
+ flexBasis?: Responsive<number | string>
+ flexGrow?: Responsive<number>
+ flexShrink?: Responsive<number>
+ gridArea?: Responsive<string>
+ gridColumn?: Responsive<string>
+ gridColumnEnd?: Responsive<string>
+ gridColumnStart?: Responsive<string>
+ gridRow?: Responsive<string>
+ gridRowEnd?: Responsive<string>
+ gridRowStart?: Responsive<string>
+ height?: Responsive<DimensionValue>
id?: string
+ isHidden?: Responsive<boolean>
+ justifySelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'left' | 'right' | 'stretch'>
+ left?: Responsive<DimensionValue>
+ margin?: Responsive<DimensionValue>
+ marginBottom?: Responsive<DimensionValue>
+ marginEnd?: Responsive<DimensionValue>
+ marginStart?: Responsive<DimensionValue>
+ marginTop?: Responsive<DimensionValue>
+ marginX?: Responsive<DimensionValue>
+ marginY?: Responsive<DimensionValue>
+ maxHeight?: Responsive<DimensionValue>
+ maxWidth?: Responsive<DimensionValue>
+ minHeight?: Responsive<DimensionValue>
+ minWidth?: Responsive<DimensionValue>
+ order?: Responsive<number>
+ position?: Responsive<'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'>
+ right?: Responsive<DimensionValue>
role?: 'group' | 'region' = 'group'
+ start?: Responsive<DimensionValue>
+ top?: Responsive<DimensionValue>
+ width?: Responsive<DimensionValue>
+ zIndex?: Responsive<number>
}/@react-spectrum/accordion:SpectrumDisclosureHeaderProps SpectrumDisclosureHeaderProps {
+ UNSAFE_className?: string
+ UNSAFE_style?: CSSProperties
+ alignSelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'center' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'stretch'>
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
+ bottom?: Responsive<DimensionValue>
children: React.ReactNode
+ end?: Responsive<DimensionValue>
+ flex?: Responsive<string | number | boolean>
+ flexBasis?: Responsive<number | string>
+ flexGrow?: Responsive<number>
+ flexShrink?: Responsive<number>
+ gridArea?: Responsive<string>
+ gridColumn?: Responsive<string>
+ gridColumnEnd?: Responsive<string>
+ gridColumnStart?: Responsive<string>
+ gridRow?: Responsive<string>
+ gridRowEnd?: Responsive<string>
+ gridRowStart?: Responsive<string>
+ height?: Responsive<DimensionValue>
id?: string
+ isHidden?: Responsive<boolean>
+ justifySelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'left' | 'right' | 'stretch'>
+ left?: Responsive<DimensionValue>
level?: number = 3
+ margin?: Responsive<DimensionValue>
+ marginBottom?: Responsive<DimensionValue>
+ marginEnd?: Responsive<DimensionValue>
+ marginStart?: Responsive<DimensionValue>
+ marginTop?: Responsive<DimensionValue>
+ marginX?: Responsive<DimensionValue>
+ marginY?: Responsive<DimensionValue>
+ maxHeight?: Responsive<DimensionValue>
+ maxWidth?: Responsive<DimensionValue>
+ minHeight?: Responsive<DimensionValue>
+ minWidth?: Responsive<DimensionValue>
+ order?: Responsive<number>
+ position?: Responsive<'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'>
+ right?: Responsive<DimensionValue>
+ start?: Responsive<DimensionValue>
+ top?: Responsive<DimensionValue>
+ width?: Responsive<DimensionValue>
+ zIndex?: Responsive<number>
} |
LFDanLu
left a comment
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.
Some small docs typos but approving for testing if you want to handle them in a follow up
|
|
||
|
|
||
| Custom styled disclosure groups can be difficult to implement in an accessible way with the correct ARIA pattern. When implementing, you must manually ensure that the button and panel are semantically connected via ids for accessibility. `DisclosureGroup` helps with this and other accessibility features while allowing for custom styling. | ||
| Accordions can be built by combing multiple disclosures built in HTML with the [<details>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) and [<summary>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary) HTML element, but this can be difficult to style especially when adding adjacent interactive elements, like buttons, to the disclosure's heading. `Accordion` helps achieve accessible disclosures implemented with the correct ARIA pattern while making custom styling easy. |
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.
Think this is supposed to reference 'DisclosureGroup' instead of accordion
| ``` | ||
| ## Props | ||
|
|
||
| ### Disclosure |
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.
| ### Disclosure | |
| ### Accordion |
| import docs from 'docs:@react-spectrum/accordion'; | ||
| import {HeaderInfo, PropTable, TypeLink, PageDescription} from '@react-spectrum/docs'; | ||
| import packageData from '@react-spectrum/accordion/package.json'; | ||
| import ChevronRight from '@spectrum-icons/workflow/ChevronRight'; |
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.
Is this needed?
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.
oh oops that's leftover from trying something else, i can follow-up on it
yihuiliao
left a comment
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.
approving for testing. i can make a follow-up for the docs stuff that Daniel commented about
From testing:
From review:
From standup:
Docs changes:
<details>and<summary>elements but there are styling limitations with things like adjacent buttons✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: