Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material/stepper): updates vertical-stepper aria roles #30577

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

essjay05
Copy link
Contributor

@essjay05 essjay05 commented Mar 3, 2025

Updates Angular Component's vertical stepper to use more generic aria roles since having the default tablist/tab/tabpanel applied to the vertical stepper violates WCAG rules of having tabpanel as a nested child within tablist. The new roles of group and region satisfy aria requirements while maintaining the current html structure of the vertical stepper.

Fixes b/361783174

@crisbeto crisbeto added the dev-app preview When applied, previews of the dev-app are deployed to Firebase label Mar 3, 2025
Copy link

github-actions bot commented Mar 3, 2025

Deployed dev-app for a28e833 to: https://ng-dev-previews-comp--pr-angular-components-30577-dev-8fa6kebf.web.app

Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt.

@essjay05 essjay05 force-pushed the change-vertical-stepper-aria-roles branch 4 times, most recently from 85afb00 to 8a56517 Compare March 7, 2025 17:08
@essjay05 essjay05 marked this pull request as ready for review March 7, 2025 17:39
@essjay05 essjay05 requested a review from a team as a code owner March 7, 2025 17:39
@essjay05 essjay05 requested review from crisbeto and andrewseguin and removed request for a team March 7, 2025 17:39
@essjay05 essjay05 force-pushed the change-vertical-stepper-aria-roles branch from 5c61ea5 to 21533e8 Compare March 7, 2025 23:31
@angular-robot angular-robot bot added the area: build & ci Related the build and CI infrastructure of the project label Mar 11, 2025
@essjay05 essjay05 force-pushed the change-vertical-stepper-aria-roles branch from 6097d6b to 71e25bf Compare March 11, 2025 01:04
@essjay05 essjay05 force-pushed the change-vertical-stepper-aria-roles branch from 71e25bf to 54bab8e Compare March 14, 2025 00:29
@angular-robot angular-robot bot added the area: docs Related to the documentation label Mar 17, 2025
@essjay05 essjay05 force-pushed the change-vertical-stepper-aria-roles branch from 9820986 to 334d4de Compare March 17, 2025 16:48
@essjay05 essjay05 requested a review from crisbeto March 17, 2025 18:03
/** Only find steps with the given selected state. */
selected?: boolean;
/** Only find steps with the given expanded state. */
expanded?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

I think we can leave the selected terminology. expanded doesn't really apply to horizontal stepper since they don't expand/collapse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So unfortunately, it looks like the aria-selected attribute can't be applied to aria role="button". I'm thinking of changing it to aria-pressed instead as it's an accepted attribute for buttons.

Copy link
Member

Choose a reason for hiding this comment

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

I still think we should keep the selected terminology in the test harness. The harness doesn't need to match the ARIA pattern.

Copy link
Contributor Author

@essjay05 essjay05 Mar 24, 2025

Choose a reason for hiding this comment

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

Hi @crisbeto, I've reverted my harness changes to use isSelected terminology instead but be based off of aria-pressed. Let me know if these new changes are sufficient. Thanks for your consult on this!

@essjay05 essjay05 force-pushed the change-vertical-stepper-aria-roles branch from 439ec62 to e43bcd2 Compare March 17, 2025 23:18
@essjay05 essjay05 requested a review from crisbeto March 18, 2025 15:55
@essjay05 essjay05 force-pushed the change-vertical-stepper-aria-roles branch 2 times, most recently from 57b1b9e to 1de20e4 Compare March 24, 2025 20:24
Updates Angular Component's vertical stepper to use more generic
aria roles since having the default tablist/tab/tabpanel applied
to the vertical stepper violates WCAG rules of having tabpanel as
a nested child within tablist. The new roles of group and region
satisfy aria requirements while maintaining the current html
structure of the vertical stepper.

Fixes b/361783174
Updates previous fix to create individual mat-step-header
tags to be used within the horizontal and vertical steppers
to make it easier to edit/understand.
Updates previous fix to add aria-expanded attribute to vertical
stepper to be more descriptive as to when the associated content
is open and the respective step is current.
Updates stepper.spec.ts to check for region role for the vertical
stepper based on the new role updates.
essjay05 added 15 commits March 25, 2025 15:50
Work on fixing failing tests.
Updates stepper.spec.ts to match updated aria-roles for vertical stepper
so that it is looking for the appropriate roles/attributes.
Reverts previously changed step-harness files.
Remove unnecessary aria-pressed from vertical stepper.
Updates stepper-harness tests to make checks depending on whether
the stepper is horizontal or vertical and checking the attributes
accordingly.
Ran command to update api golden checks with new stepper
tests.
Updates previous fix to use an ng-template instead of using
mat-step-header twice.
…ttern as vertical

Updates previous fix so that the aria-roles are cohesive between horizontal/vertical
to simplify the patterns.
Updates previous documentation so it uses the correct/updated aria roles of
, , and  with the
attribute.
…les & attributes

Updates all tests that are affected by the updated stepper aria roles and attributes.
Ran command to update API goldens.
…pper

Updates previous changes to only use aria-expanded for vertical stepper
and to add aria-pressed and aria-current values depending on the
selectedIndex value.
…utes

Updates stepper tests based on the new aria-attributes that were added to
the stepper, particularly for the horizontal stepper.
Ran command to update api goldens.
Updates previous changes to tests which used isPressed and
isExpanded to simplify to isSelected instead.
@essjay05 essjay05 force-pushed the change-vertical-stepper-aria-roles branch from 188a79b to a28e833 Compare March 25, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build & ci Related the build and CI infrastructure of the project area: docs Related to the documentation area: material/stepper dev-app preview When applied, previews of the dev-app are deployed to Firebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants