display: none vs hidden vs opacity vs aria-hidden

Hide your HTML with hidden, display:none, visibility, opacity:0, aria-hidden, inert or .sr-only: the browser answers what Wulan sees, where Bayu’s Tab lands…

Why it matters

The difference is not theory: it shows when a keyboard user Tabs into a menu nobody can see, or a screen reader stays silent on a button that is plainly on screen. The wrong way = an accessibility bug you never find by looking.

The key idea

Hiding is three separate switches, not one

Common mistakes

Try it in this playground