What fresh hell is THIS now? - Patrick Lauke
[mariusz.dabrowski] Hey all, I noticed that in Chrome when you click a button the :focus
state remains active. This doesn't happen in Firefox and Safari - Anybody know what the reasoning behind this was? And does anybody have a potential workaround to prevent it from sticking?
https://codepen.io/MarioD/pen/59509af35187d703353f5b26918619c4
.blur();
on click might be a workaround.
[svinkle] Hey @mariusz.dabrowski! It’s a good question. Although using .blur();
in this context does remove focus, the result is losing the current focus position for any keyboard-only or screen reader users. On the lick(0
event, focus would essentially be moved to the top of the document, forcing the user to navigate all the way back through to where they were. Not really ideal.
Good news is there are a few workarounds. Check out this video on “Focus Ring!” by @robdodson (https://www.youtube.com/watch?v=ilj2P5-5CjI) and the accompanying polyfill source on Github (https://github.com/wicg/focus-ring).
Additionally, I also have a solution of my own which I quite like. :$ (https://codepen.io/svinkle/pen/zzrORW)