Snap Riley
Snap Riley
KPCKevin Powell - Community
Created by Snap Riley on 10/1/2024 in #front-end
Using visibility and :focus to cause an HTML element to lose focus
I'm experimenting with preventing DOM elements (specifically input/textarea/button/a HTML elements) from getting focus. After some playtime, I stumbled on a strange and unique solution. element:focus { visibility: hidden; } This causes the element to be hidden and therefore lose focus. In turn, the lose of focus causes the element to become visible again. I'm looking for comments on this technique since the lost focus at best feels like a side effect and a hack at worst. https://codepen.io/Snap-Riley/pen/NWmJMPR
22 replies
KPCKevin Powell - Community
Created by Snap Riley on 10/1/2024 in #front-end
Using :not() & nonexistent ID to create specificity for targeted unique elements (Hackity hack)
No description
8 replies