Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ea3238b
added aria-expanded and aria-controls to Disclosure
LinKCoding Mar 21, 2025
c1991ca
update infotip aria attributes
LinKCoding Mar 21, 2025
b488938
added controls to listrow and expandcontrol
LinKCoding Mar 24, 2025
e7ba3ba
formatted
LinKCoding Mar 24, 2025
eb4bfc4
Merge branch 'main' into kl-gm-1006
LinKCoding Mar 27, 2025
375c843
fix list story
LinKCoding Mar 27, 2025
c5c7894
remove minichevron icon from list stores
LinKCoding Mar 27, 2025
af644bd
updated drawer and flyout
LinKCoding Mar 27, 2025
e3a6542
formatted
LinKCoding Mar 31, 2025
09dafab
updated drawer and flyout stories
LinKCoding Apr 1, 2025
7b8a1b0
updated guidance on listrow
LinKCoding Apr 1, 2025
b8d36af
Merge branch 'main' into kl-gm-1006
LinKCoding Apr 1, 2025
d4851a7
formatted
LinKCoding Apr 1, 2025
b9d903e
omit id from DisclosureProps
LinKCoding Apr 1, 2025
93c7be2
Merge branch 'main' into kl-gm-1006
LinKCoding Apr 2, 2025
970247f
updated disclosure types
LinKCoding Apr 2, 2025
416098d
formatted
LinKCoding Apr 2, 2025
f6dc0bc
updated disclosure to correct props and types
LinKCoding Apr 3, 2025
2fe31e1
fix typo
LinKCoding Apr 3, 2025
750cb72
Merge branch 'main' into kl-gm-1006
LinKCoding Apr 3, 2025
bba3aaf
clean up of useId
LinKCoding Apr 3, 2025
c1799a7
formatted
LinKCoding Apr 3, 2025
dd23d8f
updated disclosure body id
LinKCoding Apr 3, 2025
978394f
fixed typo in id
LinKCoding Apr 3, 2025
bdaef81
Merge branch 'main' into kl-gm-1006
LinKCoding Apr 3, 2025
f37c7d5
pushing for build
LinKCoding Apr 3, 2025
b64c25f
updated disclosure to conditionally set aria-controls
LinKCoding Apr 4, 2025
ab014d2
Merge branch 'main' into kl-gm-1006
LinKCoding Apr 4, 2025
699c116
re-implement useId()
LinKCoding Apr 4, 2025
9bafa40
update drawer/flyout examples
LinKCoding Apr 4, 2025
0499920
removed old comment and updated another
LinKCoding Apr 4, 2025
89b1cd3
Merge branch 'main' into kl-gm-1006
LinKCoding Apr 7, 2025
870787e
removed aria-controls from disclosure
LinKCoding Apr 7, 2025
269659e
leftover code cleanup
LinKCoding Apr 7, 2025
46bd453
Merge branch 'main' into kl-gm-1006
LinKCoding Apr 17, 2025
93828de
feat(Modal)!: add multiview options for back and danger variant
aresnik11 Apr 21, 2025
75cd2ae
chore(release): publish
codecademy-gh-api Apr 21, 2025
97e6c09
fix(modal + dialog): updating aria attributes per a11y team feedback
LinKCoding Apr 21, 2025
588ac4b
chore(release): publish
codecademy-gh-api Apr 21, 2025
6f2f7a0
cleaned up aria-controls
LinKCoding Apr 22, 2025
bb01462
more cleanup
LinKCoding Apr 22, 2025
118ffff
formatted
LinKCoding Apr 22, 2025
5f8463d
clean up list stories
LinKCoding Apr 22, 2025
ccb6094
Merge branch 'main' into kl-gm-1006
LinKCoding Apr 22, 2025
6faca24
more clean up
LinKCoding Apr 22, 2025
d2239d2
update chevron color
LinKCoding Apr 24, 2025
cdf1572
Merge branch 'main' into kl-gm-1006
LinKCoding Apr 24, 2025
8a23092
formatted
LinKCoding Apr 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/gamut/src/DataList/Controls/ExpandControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const ExpandControl: React.FC<ExpandColProps> = ({
aria-expanded={expanded}
>
<Rotation rotated={expanded}>
<MiniChevronDownIcon color="text-disabled" />
<MiniChevronDownIcon color="secondary" />
</Rotation>
</TextButton>
</FlexBox>
Expand Down
23 changes: 12 additions & 11 deletions packages/gamut/src/Disclosure/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,37 @@ export const Disclosure: React.FC<DisclosureProps> = ({
variant,
}) => {
const [isExpanded, setIsExpanded] = useState(initiallyExpanded);

return (
<DisclosureWrapper
as={isListItem ? 'li' : undefined}
column
variant={variant}
hasBorder={hasBorder}
onClick={() => onClick?.()}
as={isListItem ? 'li' : undefined}
variant={variant}
>
<DisclosureButton
spacing={spacing}
disabled={disabled}
heading={heading}
headingLevel={headingLevel}
overline={overline}
subheading={subheading}
isExpanded={isExpanded}
overline={overline}
setIsExpanded={setIsExpanded}
disabled={disabled}
spacing={spacing}
subheading={subheading}
/>
<AnimatePresence>
{isExpanded && (
<ExpandInCollapseOut>
<DisclosureBody
body={body}
hasPanelBg={hasPanelBg}
ctaText={ctaText}
spacing={spacing}
ctaCallback={ctaCallback}
buttonPlacement={buttonPlacement}
href={href}
buttonType={button}
ctaCallback={ctaCallback}
ctaText={ctaText}
hasPanelBg={hasPanelBg}
href={href}
spacing={spacing}
/>
</ExpandInCollapseOut>
)}
Expand Down
4 changes: 1 addition & 3 deletions packages/gamut/src/Drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ export interface DrawerProps extends Omit<BoxProps, 'width'> {
* Whether the drawer should be open.
*/
expanded?: boolean;

/**
* Which edge of the drawer content container is aligned to during the animation.
*/
alignContentContainer?: 'left' | 'right';
}

export const Drawer: React.FC<DrawerProps> = ({
alignContentContainer = 'right',
children,
expanded,
alignContentContainer = 'right',
...props
}) => {
const drawerRef = useRef<HTMLDivElement>(null);
Expand All @@ -41,7 +40,6 @@ export const Drawer: React.FC<DrawerProps> = ({
{expanded ? (
<DrawerBase
animate={{ width: fullWidth }}
aria-expanded={expanded}
bg="background-current"
exit={{ width: 0 }}
initial={{ width: 0 }}
Expand Down
4 changes: 2 additions & 2 deletions packages/gamut/src/Flyout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export interface FlyoutProps extends WithChildrenProp {
}

export const Flyout: React.FC<FlyoutProps> = ({
bg = 'background',
children,
closeLabel = 'Close',
expanded,
openFrom = 'left',
onClose,
title,
bg = 'background',
}) => {
return (
<Overlay
Expand All @@ -56,13 +56,13 @@ export const Flyout: React.FC<FlyoutProps> = ({
>
<Background bg={bg}>
<Drawer
alignContentContainer={openFrom === 'left' ? 'right' : 'left'}
bottom={0}
display="flex"
expanded={expanded}
flexDirection={openFrom === 'left' ? 'row' : 'row-reverse'}
position="fixed"
top={0}
alignContentContainer={openFrom === 'left' ? 'right' : 'left'}
{...{ [openFrom]: 0 }}
>
<FlexBox
Expand Down
1 change: 1 addition & 0 deletions packages/gamut/src/Tip/InfoTip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const InfoTip: React.FC<InfoTipProps> = ({

const tip = (
<InfoTipButton
aria-expanded={!isTipHidden}
active={!isTipHidden}
emphasis={emphasis}
onClick={() => clickHandler()}
Expand Down
22 changes: 22 additions & 0 deletions packages/styleguide/src/lib/Atoms/Drawer/Drawer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,28 @@ An example of a molecule that uses Drawer is the <LinkTo id="Molecules/Flyout">F

Our Drawers are [controlled components](https://reactjs.org/docs/forms.html#controlled-components), so their checked value must be controlled by an external state passed in as `expanded`.

The component that toggles the `Drawer` should include the `aria-expanded` attribute. The `aria-expanded` attribute should reflect the value of the `expanded` prop passed to the `Drawer`. In the example below, the `StrokeButton` controls the expansion of the `Drawer`, so the button has the `aria-expanded` attribute.

```tsx
const ExampleDrawer: React.FC = () => {
const [expanded, setExpanded] = useState(false);

return (
<FlexBox>
<Drawer expanded={expanded} id={drawerId}>
Example Drawer
</Drawer>
<StrokeButton
aria-expanded={expanded}
onClick={() => setExpanded((previousExpanded) => !previousExpanded)}
>
Set the proper aria-labels!
</StrokeButton>
</FlexBox>
);
};
```

## Playground

<Canvas sourceState="shown" of={DrawerStories.Default} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const Default: React.FC = () => {
<FlexBox bg="paleYellow" height="20rem">
<Drawer expanded={expanded}>Drawer content in here!</Drawer>
<StrokeButton
aria-expanded={expanded}
onClick={() => setExpanded((previousExpanded) => !previousExpanded)}
>
Toggle Drawer
Expand Down
24 changes: 23 additions & 1 deletion packages/styleguide/src/lib/Molecules/Flyout/Flyout.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,29 @@ On button click, a container animates in from the left or right side of the wind

Internally, Flyout is a combination of <LinkTo id="Molecules/Modals/Overlay">Overlay</LinkTo> and <LinkTo id="Atoms/Drawer">Drawer</LinkTo>.

Our Flyouts are [controlled components](https://reactjs.org/docs/forms.html#controlled-components), so their checked value must be controlled by an external state passed in as `expanded` and `onChange`:
Our Flyouts are [controlled components](https://reactjs.org/docs/forms.html#controlled-components), so their checked value must be controlled by an external state passed in as `expanded` and `onChange`.

The component that toggles the `Flyout` should include the `aria-expanded` attribute. The `aria-expanded` attribute should reflect the value of the `expanded` prop passed to the `Flyout`. In the example below, the `StrokeButton` controls the expansion of the `Flyout`, so the button has the `aria-expanded` attribute.

```tsx
const ExampleFlyout: React.FC = () => {
const [expanded, setExpanded] = useState(false);

return (
<FlexBox>
<Flyout expanded={expanded} id={flyoutId}>
Example Flyout
</Flyout>
<StrokeButton
aria-expanded={expanded}
onClick={() => setExpanded((previousExpanded) => !previousExpanded)}
>
Set the proper aria-labels!
</StrokeButton>
</FlexBox>
);
};
```

## Playground

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export const FlyoutExample: Story = {
hurricane...
</Box>
</Flyout>
<StrokeButton onClick={() => setExpanded(true)}>
<StrokeButton
aria-expanded={expanded}
onClick={() => setExpanded(true)}
>
Tell me more?!
</StrokeButton>
<FlexBox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ You can define collapsible content by passing an `expanded` prop and the `React.

#### Expand on button click

The `ListRow` component has access to the `ExpandControl` component which can be used to toggle the expanded state of the row. The `ExpandControl` component will automatically handle the rotation of the icon based on the expanded state.

```tsx
export const ExpandableRow: React.FC<{
header: string;
Expand All @@ -233,11 +235,11 @@ export const ExpandableRow: React.FC<{
<ListCol type="header">{header}</ListCol>
<ListCol type="content">{content}</ListCol>
<ListCol type="control">
<IconButton onClick={() => setExpanded(!isExpanded)}>
<Rotation rotated={isExpanded}>
<MiniChevronDownIcon />
</Rotation>
</IconButton>
<ExpandControl
expanded={isExpanded}
onExpand={() => setExpanded(!isExpanded)}
disabled={false}
/>
Comment on lines +238 to +242
Copy link
Contributor

Choose a reason for hiding this comment

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

this button used to have yellow text and now its grey. probably fine since this is just the storybook example but wanted to note

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ya, thanks Amy — I should've left a comment.
That seems intentional based on what the original component, I'll ask Stacey just in case :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gonna update to secondary to match the textButton styling :) thanks again~

</ListCol>
</ListRow>
);
Expand Down Expand Up @@ -291,15 +293,15 @@ You can combine variants and spacing to your needs.

<Canvas of={ListStories.CondensedTableGuide} />

### Expandable buttom
### Expandable button

Buttons can be configured to expand the row content.
Buttons can be configured to expand the row content. Check over the "Expand on button click" section for more guidance.

<Canvas of={ListStories.ExpandableButtonGuide} />

### Expanded row

An entire row can be made interactive to expand the row content.
An entire row can be made interactive to expand the row content. Check over the "Expand on row click" section for more guidance.

<Canvas of={ListStories.ExpandedRowGuide} />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
Box,
ExpandControl,
FillButton,
FlexBox,
IconButton,
Expand All @@ -14,7 +15,6 @@ import {
import {
ArrowChevronDownIcon,
HouseEntranceIcon,
MiniChevronDownIcon,
MiniDeleteIcon,
MiniKebabMenuIcon,
StarIcon,
Expand Down Expand Up @@ -655,11 +655,11 @@ const ExpandableButtonClickRow: React.FC<{
<ExpandedColumns name={name} role={role} ship={ship} />
<ListCol size="lg" type="control">
<TextButton>Hail</TextButton>
<TextButton onClick={() => setExpanded(!isExpanded)}>
<Rotation rotated={isExpanded}>
<MiniChevronDownIcon />
</Rotation>
</TextButton>
<ExpandControl
expanded={isExpanded}
onExpand={() => setExpanded(!isExpanded)}
disabled={false}
/>
</ListCol>
</ListRow>
);
Expand Down Expand Up @@ -705,7 +705,7 @@ export const ExpandableRowClick: React.FC<ExpandableRowProps> = ({
<ListCol size="xl" type="control">
<FlexBox mt={{ _: 8, xs: 0 }} pl={{ _: 0, xs: 16 }} width={1} center>
<Rotation rotated={isExpanded}>
<ArrowChevronDownIcon color="text-disabled" />
<ArrowChevronDownIcon color="secondary" />
</Rotation>
</FlexBox>
</ListCol>
Expand Down
Loading