You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/website/src/routes/docs/headless/(components)/accordion/index.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ import { AlphaBanner } from '../../../_components/alpha-banner/alpha-banner';
36
36
37
37
<HeroAccordion>
38
38
```tsx
39
-
<AccordionRootclass="accordion-wrapper"animate>
39
+
<AccordionRootclass="accordion-wrapper"animated>
40
40
<AccordionItem>
41
41
<AccordionHeader>
42
42
<AccordionTriggerclass="accordion-trigger">
@@ -226,7 +226,7 @@ If you're curious about how the accordion is animated, you can use a built-in Qw
226
226
227
227
The variable calculates the content height behind the scenes, so that you can use this variable in your keyframes. Out of the box, you can use the `accordion-open` and `accordion-close` keyframes in your project. These use an `animation` declaration on the height property.
228
228
229
-
> You can also check out this awesome [Cubic Bezier Tool](https://cubic-bezier.com/) to visualize the animation curve.
229
+
> The animation above makes use of the overflow hidden declaration. You can also check out this awesome [Cubic Bezier Tool](https://cubic-bezier.com/) to visualize the animation curve.
- Label for section of content that serves as a control for hiding the section.
16
-
17
-
Accordion Panel:
18
-
- Section of content that can be shown or hidden.
19
-
20
-
21
-
Keyboard interaction:
22
-
23
-
Enter or Space: When focus is on the accordion header for a collapsed panel, expands the associated panel.
24
-
25
-
If the implementation allows only one panel to be expanded, and if another panel is expanded, collapses that panel.
26
-
27
-
When focus is on the accordion header for an expanded panel, collapses the panel if the implementation supports collapsing. Some implementations require one panel to be expanded at all times and allow only one panel to be expanded; so, they do not support a collapse function.
28
-
29
-
Tab: Moves focus to the next focusable element; all focusable elements in the accordion are included in the page Tab sequence.
30
-
31
-
Shift + Tab: Moves focus to the previous focusable element; all focusable elements in the accordion are included in the page Tab sequence.
32
-
33
-
Down Arrow (Optional): If focus is on an accordion header, moves focus to the next accordion header. If focus is on the last accordion header, either does nothing or moves focus to the first accordion header.
34
-
35
-
Up Arrow (Optional): If focus is on an accordion header, moves focus to the previous accordion header. If focus is on the first accordion header, either does nothing or moves focus to the last accordion header.
36
-
37
-
Home (Optional): When focus is on an accordion header, moves focus to the first accordion header.
38
-
39
-
End (Optional): When focus is on an accordion header, moves focus to the last accordion header.
40
-
41
-
WAI-ARIA Roles, States, and Properties:
42
-
43
-
The title of each accordion header is contained in an element with role button.
44
-
45
-
Each accordion header button is wrapped in an element with role heading that has a value set for aria-level that is appropriate for the information architecture of the page.
46
-
- If the native host language has an element with an implicit heading and aria-level, such as an HTML heading tag, a native host language element may be used.
47
-
48
-
- The button element is the only element inside the heading element. That is, if there are other visually persistent elements, they are not included inside the heading element.
49
-
50
-
If the accordion panel associated with an accordion header is visible, the header button element has aria-expanded set to true. If the panel is not visible, aria-expanded is set to false.
51
-
52
-
The accordion header button element has aria-controls set to the ID of the element containing the accordion panel content.
53
-
54
-
If the accordion panel associated with an accordion header is visible, and if the accordion does not permit the panel to be collapsed, the header button element has aria-disabled set to true.
55
-
56
-
Optionally, each element that serves as a container for panel content has role region and aria-labelledby with a value that refers to the button that controls display of the panel.
57
-
- Avoid using the region role in circumstances that create landmark region proliferation, e.g., in an accordion that contains more than approximately 6 panels that can be expanded at the same time.
58
-
59
-
- Role region is especially helpful to the perception of structure by screen reader users when panels contain heading elements or a nested accordion.
60
-
61
-
Other Implementations:
62
-
63
-
Radix:
64
-
65
-
All of these have a disabled or data-disabled option
- Change behavior of the accordion to open multiple or only one item
72
-
(type="single | multiple" prop)
73
-
- Can be controlled or uncontrolled "managed by react state or by the dom"
74
-
- I believe this is done with the value prop.
75
-
- Can set a default open value with (defaultValue prop)
76
-
- Allow all items to close (collapsible prop)
77
-
78
-
Trigger & Item:
79
-
80
-
- Data state with open or closed. [data-state]
81
-
82
-
83
-
Also has a Header component that wraps around the trigger. This is because a user might want their accordion headings to be proper headers. Not sure if we will implement this for now.
84
-
85
-
Offers namespaced CSS properties used for animations.
86
-
Example: --radix-accordion-content-height
87
-
to animate the height of the content when it opens or closes.
0 commit comments