Controls on the Balai’s board with your own focus CSS: the browser answers when :focus-visible matches, on Bayu’s Tab and on Wulan’s click, what changed on…
Why it matters
A focus ring is a keyboard user’s GPS. Removing it fails WCAG 2.4.7; showing it on every click makes designers complain. :focus-visible solves both, as long as the indicator has contrast (3:1) and the cascade order does not override it.
The key idea
:focus-visible lights up when the browser judges an indicator is needed
Common mistakes
Removing the outline with outline: none, and keyboard users lose their place Always provide a replacement: :focus-visible { outline: 3px solid …; outline-offset: 2px }. No indicator fails WCAG 2.4.7.
The focus ring shows on a mouse click That is :focus. Move the ring to :focus-visible, and make sure the :focus { outline: none } rule comes first, or use :focus:not(:focus-visible).
Replacing the outline with only a background colour change A similar background is barely visible (the Background change only example: 1.1:1). An indicator needs at least 3:1 contrast against its surroundings; a firm outline with an offset is the safest.
Try it in this playground
Click the Simpan button with the mouse With the default look there is no ring: :focus-visible = false.
Tab to the Simpan button A ring shows and the log says :focus-visible = true. The same control, a different way of focusing.
Click the Nama kamu field with the mouse:focus-visible is still true: the browser expects you to type, so an indicator is still needed.
Use the outline: none situation, then Tab Focus lands, yet nothing changes on screen: Bayu is lost.