Skip to content

Commit

Permalink
fix: don't spread customization props alongside aria (#2109)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelAlev authored Nov 21, 2024
1 parent 252a06f commit 21f2d80
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-melons-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@frontify/fondue-components": patch
---

fix: don't spread customization props alongside aria in layout components
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ export const DecorativeContent = () => {
/>
);
};
DecorativeContent.displayName = 'DecorativeContent';
20 changes: 19 additions & 1 deletion packages/components/src/components/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,28 @@ export const Box = ({
as: Component = 'div',
'data-test-id': dataTestId = 'fondue-box',
children,
role,
'aria-label': ariaLabel,
'aria-hidden': ariaHidden,
'aria-describedby': ariaDescribedBy,
'aria-labelledby': ariaLabelledBy,
'aria-expanded': ariaExpanded,
'aria-haspopup': ariaHasPopup,
...props
}: BoxProps) => {
return (
<Component className={styles.root} data-test-id={dataTestId} {...props} style={propsToCssVariables(props)}>
<Component
className={styles.root}
data-test-id={dataTestId}
style={propsToCssVariables(props)}
role={role}
aria-label={ariaLabel}
aria-hidden={ariaHidden}
aria-describedby={ariaDescribedBy}
aria-labelledby={ariaLabelledBy}
aria-expanded={ariaExpanded}
aria-haspopup={ariaHasPopup}
>
{children}
</Component>
);
Expand Down
14 changes: 14 additions & 0 deletions packages/components/src/components/Flex/Flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,27 @@ export const Flex = ({
as: Component = 'div',
'data-test-id': dataTestId = 'fondue-flex',
children,
role,
'aria-label': ariaLabel,
'aria-hidden': ariaHidden,
'aria-describedby': ariaDescribedBy,
'aria-labelledby': ariaLabelledBy,
'aria-expanded': ariaExpanded,
'aria-haspopup': ariaHasPopup,
...props
}: FlexProps) => {
return (
<Component
className={styles.root}
data-test-id={dataTestId}
style={propsToCssVariables(props, { justify: 'justify-content' })}
role={role}
aria-label={ariaLabel}
aria-hidden={ariaHidden}
aria-describedby={ariaDescribedBy}
aria-labelledby={ariaLabelledBy}
aria-expanded={ariaExpanded}
aria-haspopup={ariaHasPopup}
>
{children}
</Component>
Expand Down
14 changes: 14 additions & 0 deletions packages/components/src/components/Grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,27 @@ export const Grid = ({
as: Component = 'div',
'data-test-id': dataTestId = 'fondue-grid',
children,
role,
'aria-label': ariaLabel,
'aria-hidden': ariaHidden,
'aria-describedby': ariaDescribedBy,
'aria-labelledby': ariaLabelledBy,
'aria-expanded': ariaExpanded,
'aria-haspopup': ariaHasPopup,
...props
}: GridProps) => {
return (
<Component
className={styles.root}
data-test-id={dataTestId}
style={propsToCssVariables(props, { justify: 'justify-items' })}
role={role}
aria-label={ariaLabel}
aria-hidden={ariaHidden}
aria-describedby={ariaDescribedBy}
aria-labelledby={ariaLabelledBy}
aria-expanded={ariaExpanded}
aria-haspopup={ariaHasPopup}
>
{children}
</Component>
Expand Down
26 changes: 24 additions & 2 deletions packages/components/src/components/Section/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,31 @@ export type SectionProps = LayoutComponentProps & {
'data-test-id'?: string;
} & CommonAriaProps;

export const Section = ({ 'data-test-id': dataTestId = 'fondue-section', children, ...props }: SectionProps) => {
export const Section = ({
'data-test-id': dataTestId = 'fondue-section',
children,
role,
'aria-label': ariaLabel,
'aria-hidden': ariaHidden,
'aria-describedby': ariaDescribedBy,
'aria-labelledby': ariaLabelledBy,
'aria-expanded': ariaExpanded,
'aria-haspopup': ariaHasPopup,
...props
}: SectionProps) => {
return (
<section className={styles.root} data-test-id={dataTestId} style={propsToCssVariables(props)}>
<section
className={styles.root}
data-test-id={dataTestId}
style={propsToCssVariables(props)}
role={role}
aria-label={ariaLabel}
aria-hidden={ariaHidden}
aria-describedby={ariaDescribedBy}
aria-labelledby={ariaLabelledBy}
aria-expanded={ariaExpanded}
aria-haspopup={ariaHasPopup}
>
{children}
</section>
);
Expand Down

0 comments on commit 21f2d80

Please sign in to comment.