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: (CXSPA-8997 & 8988) - Resolve Aria Issues in NavigationUIComponent #19782

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

petarmarkov9449
Copy link
Contributor

Tickets: CXSPA-8997, CXSPA-8998

Removes invalid aria-level usage on button elements and ensures buttons have a proper accessible name via aria-label or aria-labelledby.

Affects: NavigationUIComponent

@petarmarkov9449 petarmarkov9449 requested a review from a team as a code owner December 16, 2024 14:03
@github-actions github-actions bot marked this pull request as draft December 16, 2024 14:07
@petarmarkov9449 petarmarkov9449 marked this pull request as ready for review December 16, 2024 14:32
Copy link

cypress bot commented Dec 16, 2024

spartacus    Run #46434

Run Properties:  status check passed Passed #46434  •  git commit 277ea54d81 ℹ️: Merge e7617a2e629caccd466ef5db45984b5e54d4c746 into cc731978f9fb5748d79f11dd13a7...
Project spartacus
Branch Review feature/CXSPA-8997
Run status status check passed Passed #46434
Run duration 04m 12s
Commit git commit 277ea54d81 ℹ️: Merge e7617a2e629caccd466ef5db45984b5e54d4c746 into cc731978f9fb5748d79f11dd13a7...
Committer petarmarkov9449
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 125
View all changes introduced in this branch ↗︎

@github-actions github-actions bot marked this pull request as draft December 19, 2024 10:54
@petarmarkov9449 petarmarkov9449 marked this pull request as ready for review December 19, 2024 11:02
[attr.aria-haspopup]="true"
[attr.aria-expanded]="false"
[attr.aria-controls]="node.title"
[attr.aria-describedby]="getAriaDescribedbyOfButton(node)"
Copy link
Contributor

Choose a reason for hiding this comment

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

You've added it for negated cxFeature therefore if a11yButtonAriaFixes is enabled this won't be used.
However when I change it on my local it solves the previous errors, but there is one more new one:
image

@github-actions github-actions bot marked this pull request as draft December 19, 2024 11:57
@petarmarkov9449 petarmarkov9449 marked this pull request as ready for review December 19, 2024 11:57
* Returns the ID for the `aria-describedby` attribute of a button.
*/
getAriaDescribedbyOfButton(node: NavigationNode): string | null {
return node.title === 'My Account' ? 'greeting' : null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, it doesn't seem right to use the title as an identifier of the node. If this aria described by is used only for my account navigation, maybe we can pass down some input from my-account-v2-navigation.component.ts where <cx-navigation-ui> is used. Thats just from the top of my head.
I'm not sure if using 'My Account' would work with i18n...

* Removes invalid aria-level usage on button elements and ensures buttons have a proper accessible name via aria-label or aria-labelledby.
* Affects: NavigationUIComponent
*/
a11yButtonAriaFixes?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we should be more specific like a11yNavigationButtonsAriaFixes

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