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 accessibility issue #19518

Draft
wants to merge 14 commits into
base: develop
Choose a base branch
from
Draft

Fix accessibility issue #19518

wants to merge 14 commits into from

Conversation

@Jali-Khusi Jali-Khusi requested review from a team as code owners November 8, 2024 06:58
@github-actions github-actions bot marked this pull request as draft November 8, 2024 06:58
Copy link
Contributor

@Pio-Bar Pio-Bar left a 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.

Copy link
Contributor

@Pio-Bar Pio-Bar left a 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.

Comment on lines -59 to -60
position,
listLength,
Copy link
Contributor

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

Copy link
Contributor Author

@Jali-Khusi Jali-Khusi Jan 9, 2025

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

Copy link
Contributor

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.

Copy link
Contributor

@Pio-Bar Pio-Bar left a 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!

Comment on lines -59 to -60
position,
listLength,
Copy link
Contributor

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"
Copy link
Contributor

@Pio-Bar Pio-Bar Jan 14, 2025

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.

Comment on lines 134 to 159
<span
role="heading"
aria-level="4"
*ngIf="node.title"
[attr.tabindex]="-1"
>
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Comment on lines 232 to 233
margin-top: 10px;
margin-bottom: 10px;
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the margin-top: 10px; and margin-bottom: 10px; because they were causing some unwanted gaps between the list items. If you'd prefer, I can revert this change
gap-list

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is screenshot from the current bugs-acc-issue branch. If we remove the margins the main navigation will shift.

I understand this fixes the issue for this particular case. At the same time we can not break other implementations. These changes should be kept within the affected component.

Screenshot 2025-01-24 at 10 17 39


@media screen and (max-width: 1024px) {
.LeftContentSlot {
max-width: 26% !important;
Copy link
Contributor

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.

Comment on lines 232 to 233
margin-top: 10px;
margin-bottom: 10px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Here is screenshot from the current bugs-acc-issue branch. If we remove the margins the main navigation will shift.

I understand this fixes the issue for this particular case. At the same time we can not break other implementations. These changes should be kept within the affected component.

Screenshot 2025-01-24 at 10 17 39

@@ -321,6 +319,7 @@

%cx-navigation-ui {
display: flex;
display: contents;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a significant change, not sure why flex would be overwritten here. This will surely affect the layout.

image

Comment on lines 16 to 20
export class MyAccountV2NavigationComponent extends NavigationComponent {
navAriaLabel$: Observable<any> = this.name$.pipe(
map((name: any) => name ?? 'MyAccount View Side Navigation')
);
}
Copy link
Contributor

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)
Copy link
Contributor

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.

Comment on lines 132 to 150
[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
"
Copy link
Contributor

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?

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.

3 participants