Common mistakes
Common mistakes in the Accessibility guide.
aria-expandedand friends written as presence attributes. Pass the boolean; the runtime writes"true"/"false". Do not writearia-expanded={open() || undefined}, which removes the state when closed.hidden={open() ? undefined : true}on a panel whose content you still want searchable.hiddenremoves it from the tree; use<Show>only when you want it gone from the DOM too.- Focus in a
ref. The element is not in the document yet; useonMount. - Clickable
divs andspans. Use abuttonor ana. - Icon-only buttons without a name. Add
aria-label(or visually hidden text). Showaround a live region. Render the region always.- Ids from counters or
Math.random(). UseuseId. - Focus lost on route change or when the focused element is removed. Decide where focus goes.