Skip to content

Add aria-label to Accordion Button and update documentation#3755

Merged
precious-onyenaucheya-ons merged 4 commits intomainfrom
feature/include-aria-label-to-accordion-button
Nov 4, 2025
Merged

Add aria-label to Accordion Button and update documentation#3755
precious-onyenaucheya-ons merged 4 commits intomainfrom
feature/include-aria-label-to-accordion-button

Conversation

@precious-onyenaucheya-ons
Copy link
Copy Markdown
Contributor

@precious-onyenaucheya-ons precious-onyenaucheya-ons commented Oct 31, 2025

What is the context of this PR?

#1377

This PR addresses the accessibility issue with accordion “Show all” and “Hide all” buttons having identical labels, which caused ambiguity for screen reader users when multiple accordion components were present on the same page.

To resolve this, two new optional parameters have been added:

  • openAriaLabel – Defines a custom aria-label for the “Show all” button.
  • closeAriaLabel – Defines a custom aria-label for the “Hide all” button.

These parameters allow each accordion instance to have unique and descriptive aria labels, providing better context for assistive technologies.
Default values are also included in case these parameters are not set.

How to review this PR

  • Open or create an accordion component that uses the allButton configuration.
  • Add the new parameters to the configuration, for example:
"allButton": {
  "open": "Show all",
  "close": "Hide all",
  "openAriaLabel": "Show all glossary terms",
  "closeAriaLabel": "Hide all glossary terms"
}

  • Inspect the rendered “Show all” and “Hide all” buttons in the HTML.
  • Confirm that each button includes the correct aria-label values.
  • Remove the parameters and confirm that the default aria-labels are still applied.
  • Test with multiple accordion components on the same page to verify that each set of buttons can have unique aria-labels and are distinguishable by screen readers.

Checklist

This needs to be completed by the person raising the PR.

  • I have selected the correct Assignee
  • I have linked the correct Issue

@netlify
Copy link
Copy Markdown

netlify bot commented Oct 31, 2025

Deploy Preview for ons-design-system-preview ready!

Name Link
🔨 Latest commit ba812ec
🔍 Latest deploy log https://app.netlify.com/projects/ons-design-system-preview/deploys/6909f7d3e845850008ea7c73
😎 Deploy Preview https://deploy-preview-3755--ons-design-system-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@precious-onyenaucheya-ons precious-onyenaucheya-ons marked this pull request as ready for review November 3, 2025 12:31
@precious-onyenaucheya-ons precious-onyenaucheya-ons requested a review from a team as a code owner November 3, 2025 12:32
@precious-onyenaucheya-ons precious-onyenaucheya-ons added the Accessibility Issues discovered through accessibility testing label Nov 3, 2025
@precious-onyenaucheya-ons precious-onyenaucheya-ons marked this pull request as draft November 3, 2025 12:32
@precious-onyenaucheya-ons precious-onyenaucheya-ons marked this pull request as ready for review November 3, 2025 15:50
Copy link
Copy Markdown
Contributor

@sveltifier sveltifier left a comment

Choose a reason for hiding this comment

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

Great!

Copy link
Copy Markdown
Contributor

@sveltifier sveltifier left a comment

Choose a reason for hiding this comment

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

Great!

@precious-onyenaucheya-ons precious-onyenaucheya-ons merged commit ad1d1d3 into main Nov 4, 2025
14 of 16 checks passed
@precious-onyenaucheya-ons precious-onyenaucheya-ons deleted the feature/include-aria-label-to-accordion-button branch November 4, 2025 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accessibility Issues discovered through accessibility testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants