-
Notifications
You must be signed in to change notification settings - Fork 205
feat: Replace use of :focus-visible shim #3792
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
base: main
Are you sure you want to change the base?
Conversation
9d5c8d2 to
f0e1c0e
Compare
|
I've updated this branch to take a more careful approach. Notably, the shim had greater specificity (two class selectors instead of one). In one case I've used a double-specifier ( |
|
Thanks for opening the PR! Running screenshot tests on the PR to confirm everything checks out visually. I already made a similar attempt earlier (#3598, #3615, #3599, #3607), but it led to enough visual discrepancies that it got me to step back from it for a bit. For context, it mostly concerns the fact that the JS utility is hidden by default until a keyboard event is detected, but the native |
|
@avinashbot Ah, sorry that I missed those earlier PRs! The behavior in this PR would be the same: Can you tell me exactly what behavior you're seeing in Safari? Like, does the close button on a modal get visible focus after that modal was opened via mouse click? |
All targeted browsers now support :focus-visible. This commit removes the use of the shim defined in @cloudscape-design/component-toolkit. Once this change is merged, the shim can be removed.
f0e1c0e to
fe65778
Compare
|
I've updated the branch and added a list of benefits to the PR description. Performance-wise, the benefits are more modest than I'd have expected. I think it really comes down to whether you want the shim's behavior or the native |
All targeted browsers now support
:focus-visible: https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible#browser_compatibilityThis commit removes the use of the shim defined in @cloudscape-design/component-toolkit. Once this change is merged, the shim can be removed.
Benefits
This change would reduce CSS and JS bundle sizes by ~1KB. It would also eliminate the global
mousedown/keydownevent listeners required by the shim, which should improve runtime performance.Additionally, following the browser's native
:focus-visiblebehavior is arguably an a11y improvement.Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.