Skip to content

Commit

Permalink
fix: accordion: remove role presentation and add default aria-label o…
Browse files Browse the repository at this point in the history
…n expand toggle button for a11y (#887)

* fix: accordian: remove role presentation on expand button

* fix: accordian: add default ariaLabel on expand button

* fix: accordion: add aria label back to the expand button

---------

Co-authored-by: Jeff Howard <106610186+jhoward-eightfold@users.noreply.github.com>
  • Loading branch information
2 people authored and Jeff Howard committed Sep 9, 2024
1 parent 2804d89 commit d30dd08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ export const AccordionSummary: FC<AccordionSummaryProps> = ({
{badgeProps && <Badge classNames={styles.badge} {...badgeProps} />}
</div>
<Button
role="presentation"
tabIndex={-1}
aria-controls={`${id}-content`}
ariaLabel={expanded ? expandAriaLabelText : collapseAriaLabelText}
disabled={disabled}
gradient={gradient}
iconProps={{ classNames: iconButtonClassNames, ...expandIconProps }}
Expand Down
14 changes: 7 additions & 7 deletions src/components/Accordion/__snapshots__/Accordion.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ exports[`Accordion Accordion is large 1`] = `
<button
aria-controls="myAccordionId-content"
aria-disabled="false"
aria-label="Accordion"
class="button button-neutral button-medium round-shape icon-left"
role="presentation"
tabindex="-1"
>
<span
Expand Down Expand Up @@ -152,8 +152,8 @@ exports[`Accordion Accordion is medium 1`] = `
<button
aria-controls="myAccordionId-content"
aria-disabled="false"
aria-label="Accordion"
class="button button-neutral button-medium round-shape icon-left"
role="presentation"
tabindex="-1"
>
<span
Expand Down Expand Up @@ -249,8 +249,8 @@ exports[`Accordion Accordion is not bordered 1`] = `
<button
aria-controls="myAccordionId-content"
aria-disabled="false"
aria-label="Accordion"
class="button button-neutral button-medium round-shape icon-left"
role="presentation"
tabindex="-1"
>
<span
Expand Down Expand Up @@ -346,8 +346,8 @@ exports[`Accordion Accordion is pill shaped 1`] = `
<button
aria-controls="myAccordionId-content"
aria-disabled="false"
aria-label="Accordion"
class="button button-neutral button-medium round-shape icon-left"
role="presentation"
tabindex="-1"
>
<span
Expand Down Expand Up @@ -443,8 +443,8 @@ exports[`Accordion Accordion is rectangle shaped 1`] = `
<button
aria-controls="myAccordionId-content"
aria-disabled="false"
aria-label="Accordion"
class="button button-neutral button-medium round-shape icon-left"
role="presentation"
tabindex="-1"
>
<span
Expand Down Expand Up @@ -635,8 +635,8 @@ exports[`Accordion Accordion renders custom content and its buttons are clickabl
<button
aria-controls="myAccordionId-content"
aria-disabled="false"
aria-label="Accordion"
class="button button-neutral button-medium round-shape icon-left"
role="presentation"
tabindex="-1"
>
<span
Expand Down Expand Up @@ -732,8 +732,8 @@ exports[`Accordion Renders without crashing 1`] = `
<button
aria-controls="myAccordionId-content"
aria-disabled="false"
aria-label="Accordion"
class="button button-neutral button-medium round-shape icon-left"
role="presentation"
tabindex="-1"
>
<span
Expand Down

0 comments on commit d30dd08

Please sign in to comment.