-
Notifications
You must be signed in to change notification settings - Fork 14
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(SCS-70): structured-list with divider a11y issue #710
fix(SCS-70): structured-list with divider a11y issue #710
Conversation
You can preview these changes on: |
<hr | ||
aria-hidden="true" |
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 parent has aria-hidden, the children hr, in that case, does not need it.
but looking into Divider I don't think is something we can support.
Have you checked if that's ok with axe and SR?
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.
Yes, we can't remove the aria-hidden
from Divider in its current implementation.
I've added role="list"
to an example for test and there were no errors on Axe and the screen reader is navigating smoothly through the list, no mentioning for dividers or any other unwanted elements.
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.
It looks good from Screen Reader point ov view. Just wondering.. HTML wise, why are we doing
<ul>
<li> Item</li>
<li>Divider</li>
<li>Item</li>
<li>Divier</li>
</ul>
and not
<ul>
<li>
Item
Divider
</li>
<li>
Item
Divider
</li>
</ul>
Semantically would be more correct IMO 🤔 and bring less HTML nodes in the DOM
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 think it would be hard to do it like this
<li>
Item
Divider
</li>
because we get the items like this
const structuredListChildren = React.Children.toArray(
children,
) as React.ReactElement<StructuredListItemProps>[];
so the children are in the hands of the users and we can't easily determine where to put the divider.
I get your point but it doesn't look like a straightforward thing to do and for the less DOM nodes point, isn't is the same, the Divider is still an hr
element, the amount of nodes should be the same, the hr
will just be nested?
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 guess you will have one less <li>
element, as the <hr>
would not need wrapping. But yeah, get it, not straightforward 👍
Shall we add also role='list' in storybook scenarios? so we can capture this or other faulty scenarios. |
Don't know to be honest, the whole component has the role - list implicitly either way. So in theory no one should use Not sure why this a11y error is showing only after adding the role. If we want an example of that we would have to extend the StructuredList props to accept |
SCS-70
What
StructuredList
withDivider
has an a11y issue #709role="list"
I have done:
I have tested manually:
Before:
After:
Who should review this PR:
How to test: