Skip to content

feat(button): improve accessibility #IX-3930#2399

Open
alexkaduk wants to merge 6 commits intomainfrom
feature/IX-3930
Open

feat(button): improve accessibility #IX-3930#2399
alexkaduk wants to merge 6 commits intomainfrom
feature/IX-3930

Conversation

@alexkaduk
Copy link
Collaborator

💡 What is the current behavior?

Button components lack proper accessibility attributes for screen readers, particularly icon-only buttons that have no visible text labels. Additionally, there is no automated accessibility testing in place to ensure AA compliance.

🆕 What is the new behavior?

Accessibility Improvements:

  • Added aria-label attributes to all icon-only buttons (ix-icon-button and icon-only ix-button) to provide accessible names for screen readers
  • Icons within buttons are now properly marked as decorative following ARIA best practices

Testing Enhancements:

  • Integrated axe-core accessibility smoke tests across all framework test apps (Angular, Angular Standalone)
  • Added automated accessibility checks to ensure ongoing AA compliance
  • Updated accessibility tree snapshots to reflect improved component structure

Component Updates:

  • Enhanced button-loading examples with better accessibility patterns
  • Added button danger variants for consistency (danger, danger-ghost, danger-outline)
  • Updated button examples to demonstrate accessible icon usage patterns (icon-left and icon-right)

🏁 Checklist

A pull request can only be merged if all of these conditions are met (where applicable):

  • 🦮 Accessibility (a11y) features were implemented
  • 🗺️ Internationalization (i18n) - no hard coded strings
  • 📲 Responsiveness - components handle viewport changes and content overflow gracefully
  • 📕 Add or update a Storybook story
  • 📄 Documentation was reviewed/updated siemens/ix-docs
  • 🧪 Unit tests were added/updated and pass (pnpm test)
  • 📸 Visual regression tests were added/updated and pass (Guide)
  • 🧐 Static code analysis passes (pnpm lint)
  • 🏗️ Successful compilation (pnpm build, changes pushed)

@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: f91a6fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@siemens/ix Patch
@siemens/ix-angular Patch
@siemens/ix-docs Patch
@siemens/ix-react Patch
@siemens/ix-vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @alexkaduk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the accessibility of button components, particularly for icon-only buttons, by implementing proper ARIA attributes. It also introduces automated accessibility testing using axe-core across various framework test applications, ensuring that future changes maintain AA compliance. Additionally, new button variants and updated examples enhance the component library's robustness and usability.

Highlights

  • Accessibility Improvements: Added aria-label attributes to icon-only buttons (ix-icon-button and icon-only ix-button) to enhance screen reader compatibility. Icons within buttons are now correctly marked as decorative following ARIA best practices.
  • Testing Enhancements: Integrated axe-core accessibility smoke tests across all framework test applications (Angular, Angular Standalone, Vue) to ensure ongoing AA compliance. Accessibility tree snapshots were updated to reflect the improved component structure.
  • Component Updates: Enhanced button-loading examples with better accessibility patterns. Added new button danger variants (danger, danger-ghost, danger-outline) for consistency. Updated button examples to demonstrate accessible icon usage patterns, including icon-left and icon-right.
Changelog
  • packages/angular-standalone-test-app/smoke-tests/preview-examples.spec.ts
    • Added import for working-with-axe.spec.ts to include accessibility tests.
  • packages/angular-standalone-test-app/src/preview-examples/button-loading.html
    • Updated ix-button and ix-icon-button examples to use outline variant.
    • Added aria-label attributes to icon-only buttons for improved accessibility.
    • Modified text for a loading button example.
  • packages/angular-standalone-test-app/src/preview-examples/button-loading.ts
    • Imported IxButton and IxIconButton for standalone component usage.
    • Updated component decorator to use templateUrl instead of template and added imports array.
  • packages/angular-standalone-test-app/src/preview-examples/button-text-icon.ts
    • Added new ix-button examples demonstrating icon-right usage.
  • packages/angular-test-app/smoke-tests/preview-examples.spec.ts
    • Added import for working-with-axe.spec.ts to include accessibility tests.
  • packages/angular-test-app/src/app/app-routing.module.ts
    • Imported new button danger variants (ButtonDanger, ButtonDangerGhost, ButtonDangerOutline).
    • Added routes for the new button danger variants.
  • packages/angular-test-app/src/app/app.module.ts
    • Imported new button danger variants (ButtonDanger, ButtonDangerGhost, ButtonDangerOutline).
    • Added new button danger variants to the declarations array.
  • packages/angular-test-app/src/preview-examples/button-loading.html
    • Updated ix-button and ix-icon-button examples to use outline variant.
    • Added aria-label attributes to icon-only buttons for improved accessibility.
    • Modified text for a loading button example.
  • packages/angular-test-app/src/preview-examples/button-loading.ts
    • Updated component decorator to use templateUrl instead of template.
  • packages/core/src/components.d.ts
    • Added @deprecated JSDoc tag to the ariaLabelButton property, indicating it will be removed in version 5.0.0.
  • packages/core/src/components/button/button.tsx
    • Imported a11yHostAttributes utility.
    • Added @deprecated JSDoc tag to the ariaLabelButton property.
    • Modified aria-label assignment to prioritize the native aria-label from the host element, falling back to ariaLabelButton.
  • packages/html-test-app/src/preview-examples/button-loading.html
    • Added aria-label attributes to icon-only buttons for improved accessibility.
  • packages/react-test-app/src/preview-examples/button-loading.tsx
    • Added aria-label attributes to icon-only buttons for improved accessibility.
    • Modified text for a loading button example.
  • packages/react-test-app/src/preview-examples/buttons.tsx
    • Removed an unnecessary newline in the button example.
  • packages/storybook-docs/src/stories/button/accessibility/a11y-button.stories.ts
    • Added a new Storybook file dedicated to button accessibility examples, including icon-only buttons with aria-label, disabled states, loading states, link buttons, buttons with aria-describedby, and multiple icon positions.
  • packages/vue-test-app/package.json
    • Updated the test script to use playwright test for smoke tests.
  • packages/vue-test-app/smoke-tests/preview-examples.spec.ts
    • Added import for working-with-axe.spec.ts to include accessibility tests.
  • packages/vue-test-app/src/preview-examples/button-loading.vue
    • Updated IxButton and IxIconButton examples to use outline variant.
    • Added aria-label attributes to icon-only buttons for improved accessibility.
    • Modified text for a loading button example.
  • testing/framework-tests/snapshots/button-loading-aria-snapshot.yaml
    • Updated the accessibility snapshot for button loading examples to reflect new aria-label and structure.
  • testing/framework-tests/snapshots/button-with-icon-aria-snapshot.yaml
    • Updated the accessibility snapshot for button with icon examples.
  • testing/framework-tests/tests/working-with-axe.spec.ts
    • Added imports for various button-related axe accessibility test files.
  • testing/framework-tests/tests/working.spec.ts
    • Added imports for various button-related functional test files.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly improves the accessibility of button components by adding aria-label attributes, particularly for icon-only buttons, and integrates axe-core for automated accessibility testing. The changes are well-implemented, including the deprecation of the ariaLabelButton prop in favor of the native aria-label. I've identified some minor issues in the example files where button states are unintentionally shared, which could be confusing for developers using the examples. Overall, this is a valuable contribution that enhances both accessibility and testing infrastructure.

@alexkaduk
Copy link
Collaborator Author

/gemini help

@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@alexkaduk
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces significant accessibility improvements for button components, including the addition of aria-label for icon-only buttons and the integration of automated accessibility testing using axe-core. It also adds new danger button variants and updates examples to follow accessible patterns. Overall, the changes are well-aligned with accessibility best practices, though there are a few areas where the implementation could be more robust or where testing coverage might have been unintentionally reduced.

@alexkaduk
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces significant accessibility improvements to the button components, most notably by integrating axe-core for automated testing and standardizing on native aria-label attributes. The changes are well-implemented and consistent across the different framework wrappers. I've identified a minor inconsistency in the ix-icon-toggle-button that could be improved for better accessibility, and a suggestion to reduce code duplication in one of the React examples. Overall, this is an excellent contribution that enhances the project's quality and accessibility.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants