-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fides-js accessibility wrap up #3510
Conversation
Passing run #2606 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
This is so that the overlay will be the first thing a keyboard user can navigate to and to help the overlay stay on top of all other elements
e166fc0
to
51057ee
Compare
Manually testing this- just to confirm, a side effect of this is that the banner no longer animates when it is closed. This is fine by me (and makes more sense than animating it when the user wishes it to be closed), but want to make sure it's expected. |
ahh good catch, no that wasn't intentional! I put in a quick fix so that we get the animation when closing again. if we don't want it in the future, we can revert 0998729 but for now I didn't want to add something unintentionally :) |
Closes #3309
Code Changes
The bulk of the a11y work was done while developing, but this should cover the straggling items.
Steps to Confirm
fides-js-components-demo.html
Pre-Merge Checklist
CHANGELOG.md
Description Of Changes
I went through a few sites, and I don't think there's actual regulation on where a banner should appear in a tab order. This blog post recommends having them come up as soon as possible, though I ran into some sites that have them at the very end (where you have to tab through the entire page, including footers, before you can get to the banner. example: https://stackoverflow.com/) but other sites make sure they're the first thing you tab through. example: https://liveramp.com/). I thought it made sense to have it come up as soon as possible, though this means we
document.body.prepend
instead ofdocument.body.appendChild
. In other words, the overlay becomes the top DOM element. Because of this, I also gave the overlay an overall high z-index to increase the chance we stay on top of the host site's elements (we probably wanted this anyway)There might be other ways to have the banner receive focus first other than doing a prepend:
autoFocus
attr on a button in the banner, however this apparently has a11y drawbacks (vscode warns against it)I haven't come across any drawbacks with prepending instead of appending yet, but we'll see!