-
Notifications
You must be signed in to change notification settings - Fork 38
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
Xander/carousel accessibility compliance #1416
Conversation
packages/itwinui-react/src/core/Carousel/CarouselNavigation.tsx
Outdated
Show resolved
Hide resolved
@@ -51,7 +51,6 @@ export const CarouselSlide = React.forwardRef((props, ref) => { | |||
<Box | |||
as='li' | |||
className={cx('iui-carousel-slider-item', className)} | |||
role='tabpanel' |
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 believe you need role='group'
when using aria-roledescription
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.
Adding that role causes MainExample
and ControlledExample
to fail. These errors were present before I started this PR as well, and removing the original tabpanel
role got rid of them. If you think it's necessary, I can try to look for another way to fix these issues while keeping the group
(or tabpanel
) role.
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.
that's interesting, because APG suggests using role=group
(check the heading "Basic carousel elements")
i believe it might be because we are using li
. we could make it a generic div
. if we do that, the parent ol
would also need to be a div
.
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.
Done
@@ -46,8 +46,7 @@ export default () => { | |||
{gradients.map(({ from, to }, index) => ( | |||
<li | |||
key={index} | |||
role='tabpanel' | |||
id={`${id}-slide-${index}`} | |||
id={`${id}--slide-${index}`} |
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.
why was this id changed?
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.
hmm i think this behavior is actually wrong. CarouselDotsList
is the component, whereas Carousel.onlyDots
is the example; the latter should not rely on implementation details of the former.
i wonder if we even need id
and aria-controls
. since we removed role=tabpanel
in #1416 (comment), i think role=tab
can also be removed from CarouselDot
. i will double check tomorrow.
you can also try to read through APG on your own and compare our markup with theirs.
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.
so i've been looking into this and need more time. I think fixing Carousel accessibility would require some bigger changes across the whole component, so you could move this PR to draft and work on a different PR in the meantime.
i will pick up Carousel later
There's a unit test that's failing, so I'm going to work on that too. |
Done, just had to update a querySelector (ul -> div) and a role (tabpanel -> group) |
Changes
Bringing
Carousel
component to accessibility compliance by distributing proper roles and labels within the component.Addresses #1148.
Testing
Evaluated using Cypress a11y tests. Unit & visual testing conducted as needed.
Docs
N/A