-
Notifications
You must be signed in to change notification settings - Fork 112
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
Fixes accessibility issues with accordion #1176
Conversation
0ffc132
to
52a176e
Compare
**Why**: previous implmentation wasn't using aria attributes correctly
52a176e
to
625d6b1
Compare
lgtm, but maybe @hursey013 should take a look too. |
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.
In order to make the accordion keyboard accessible I think we'll want to have a tabindex="0"
on the element that is acting as the button. We'll probably need to modify the JS a bit to allow a the keyboard to expand/collapse it as well because I think only a mouse click will work now.
@hursey013 I added a keyup event binding. I'm going to need to refactor how this works a bit so we can remove the duplicated logic in |
**Why**: WIA-ARIA Spec requires that an accordion component respond to `enter` and `space` keys
1224d8a
to
4c7160a
Compare
@el-mapache Just tested it, works great! Final nitpick, would be nice to have Let me know if I can help with |
@hursey013 So I don't know a lot about accessibility, is making the close link behave the same way just good practice? It seems like the close link is basically not needed in this case, since the user will remain focused on the heading element while the accordion is open. This is probably very wrong wrt to how screen readers actually operate 😬 If the answer is just 'more is better' that makes sense to me too! |
I'm definitely in the middle of learning more about accessibility, but one of the criteria we need to achieve is: "All functionality of the content is operable through a keyboard interface". So in the case of someone that cannot use a mouse, the expected behavior is that they will be able to tab to all links or interactive elements on the page, and each element will also have some sort of visual indication that it is currently in focus. https://www.w3.org/TR/UNDERSTANDING-WCAG20/keyboard-operation.html https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-focus-visible.html |
Yep, totally understand that some level of keyboard interaction is necessary for accessibility. Specifically, the page I was working off of (https://www.w3.org/TR/wai-aria-practices/#aria_ex) for this component specifies that only I guess my question is, do we ever stop and evaluate when to add things like a |
I think in this case since it appears visually to be a link it makes sense to have it behave like a link, but yeah I agree I don't think we should overdo it because that will actually have the opposite effect on accessibility. Sticking with semantic HTML will do most of the heavy lifting for us, I really just see us needing to pay extra attention to a few of our unique components like the accordions, modals and tooltips. |
That makes perfect sense, thanks! |
0a2ffba
to
c1122fc
Compare
@hursey013 seems like all the CC/rspec errors have been accounted for, if you wouldn't mind taking another look. |
} | ||
|
||
close() { | ||
this.el.setAttribute('aria-expanded', 'false'); | ||
this.content.setAttribute('aria-hidden', 'true'); | ||
this.setExpanded(false); |
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.
yep, forgot about that.
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.
@hursey013 focused!
**Why**: We were duplicating some logic in a file consuming the accordion. Extra tabindicies mean extra accessibility
c1122fc
to
d6330b1
Compare
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.
lgtm! thanks for cleaning up the previous address js as well!
Why: previous implmentation wasn't using aria attributes correctly