-
Notifications
You must be signed in to change notification settings - Fork 393
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 accessibility issue #19518
base: develop
Are you sure you want to change the base?
Fix accessibility issue #19518
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes would be considered breaking. We should put them behind a feature toggle like other a11y ones. They can be recognized by the a11y
prefix we include for each one.
projects/storefrontlib/cms-components/navigation/navigation/navigation-ui.component.html
Outdated
Show resolved
Hide resolved
projects/storefrontlib/cms-components/navigation/navigation/navigation-ui.component.html
Outdated
Show resolved
Hide resolved
projects/storefrontlib/cms-components/navigation/navigation/navigation-ui.component.html
Outdated
Show resolved
Hide resolved
projects/storefrontlib/cms-components/navigation/navigation/navigation-ui.component.html
Outdated
Show resolved
Hide resolved
projects/storefrontlib/cms-components/navigation/navigation/navigation-ui.component.html
Outdated
Show resolved
Hide resolved
projects/storefrontstyles/scss/components/content/navigation/_my-account-v2-navigation.scss
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of my older concerns are still valid, Please let me know if you have any doubts, thanks.
projects/storefrontlib/cms-components/navigation/navigation/navigation-ui.component.html
Outdated
Show resolved
Hide resolved
projects/storefrontlib/cms-components/navigation/navigation/navigation-ui.component.html
Outdated
Show resolved
Hide resolved
position, | ||
listLength, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a proper list count is one of the requirements we need to meet. Let's make sure it's preserved where needed.
https://jira.tools.sap/browse/CXSPA-8035
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback. Regarding the JIRA ticket https://jira.tools.sap/browse/CXSPA-7979 , I addressed the issue where additional information like "list with 1 item, list with 3 items" was being read out when accessing the ‘Saved Carts’ list item within the ‘Order Information’ group. I’ve updated the aria-label to ensure only relevant information is announced, removing redundant details. The list count is preserved as needed, but without unnecessary repetition for screen readers.
Let me know if further adjustments are needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removed translation seems not to be related to the one mentioned in the ticket. ("list with 1 item, list with 3 items"). Each option should include its count within the list ( n of n options). However, if this case is different an exception would need to be made for it. We cannot remove this from other implementations as this is a functionality we need to upkeep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do have concerns about some of the changes being made to the navigation-ui
component. This component is reused within Spartacus for quite important features like the main navigation. We should be especially careful modifying it since the changes impact other implementations. Some a11y improvements have been made already and if we are going to introduce new ones they can't be to the detriment of the existing ones.
I've brought to attention that some of these changes are considered breaking. We need to properly handle those by using feature flags, this mitigates any possible problems our clients might face. More information can be found on the wiki and here is a nice writeup about the new FF system for CSS changes.
Feel free to reach out to me directly or any a11y team members for help!
position, | ||
listLength, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removed translation seems not to be related to the one mentioned in the ticket. ("list with 1 item, list with 3 items"). Each option should include its count within the list ( n of n options). However, if this case is different an exception would need to be made for it. We cannot remove this from other implementations as this is a functionality we need to upkeep.
@@ -106,7 +104,6 @@ | |||
</ng-container> | |||
<ng-container *cxFeature="'a11yNavigationUiKeyboardControls'"> | |||
<button | |||
aria-level="4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the role is set to heading
we need to specify the level too.
<span | ||
role="heading" | ||
aria-level="4" | ||
*ngIf="node.title" | ||
[attr.tabindex]="-1" | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These attributes are required by the main navigation in the header and provide a good a11y experience for that use case. We need to satisfy both cases, we cannot remove one in favour of the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Pio-Bar
Thank you for your message. As per my understanding, I have implemented the changes accordingly. Could you kindly suggest if there is an alternative approach I could take that would allow me to make adjustments without affecting the current functionality?
margin-top: 10px; | ||
margin-bottom: 10px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid these changes will influence the look of other implementations as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
@media screen and (max-width: 1024px) { | ||
.LeftContentSlot { | ||
max-width: 26% !important; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not use the !important
to override styles.
margin-top: 10px; | ||
margin-bottom: 10px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -321,6 +319,7 @@ | |||
|
|||
%cx-navigation-ui { | |||
display: flex; | |||
display: contents; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export class MyAccountV2NavigationComponent extends NavigationComponent { | ||
navAriaLabel$: Observable<any> = this.name$.pipe( | ||
map((name: any) => name ?? 'MyAccount View Side Navigation') | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the CMS data would modify the outcome of the logic based on this. If the name was added the count would be present too. It's probably not what we want.
We should not use a hard coded string for comparison.
position, | ||
listLength, | ||
} | ||
navAriaLabel !== ('navigation.myAccountSideNavigation' | cxTranslate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should not base logic on a translation. Maybe we can include provideOptionCount
input set to true
by default. This way we would have an easy way to disable the option count where needed.
[attr.role]=" | ||
navAriaLabel !== | ||
('navigation.myAccountSideNavigation' | cxTranslate) | ||
? 'heading' | ||
: 'presentation' | ||
" | ||
[attr.aria-level]=" | ||
navAriaLabel !== | ||
('navigation.myAccountSideNavigation' | cxTranslate) | ||
? 4 | ||
: null | ||
" | ||
*ngIf="node.title" | ||
[attr.tabindex]="-1" | ||
[attr.tabindex]=" | ||
navAriaLabel !== | ||
('navigation.myAccountSideNavigation' | cxTranslate) | ||
? -1 | ||
: 0 | ||
" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the title be stripped of its semantic value? As mentioned previously, role presentation
hides the element from accessibility software. In this case it's ignored because the tab index is 0. If these are a11y improvements, the intention here is not clear to me. Are we reducing the title to just a pice of text in this case?
List of bugs resolved in this PR:
https://jira.tools.sap/browse/CXSPA-7980
https://jira.tools.sap/browse/CXSPA-7979
https://jira.tools.sap/browse/CXSPA-7978
https://jira.tools.sap/browse/CXSPA-7983
https://jira.tools.sap/browse/CXSPA-7987
https://jira.tools.sap/browse/CXSPA-7981