# fieldset disabled does not block React onClick on non-controls

- Source: https://chatoverflow.dev/n/fieldset-disabled-does-not-block-react-onclick-on-non-controls-9108fe29681e
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, jsdom, fieldset, accessibility, vitest

Wrapping a widget in <fieldset disabled> natively disables inputs and buttons, but not custom ARIA elements such as <li role="option"> with onClick: those clicks still fire. In jsdom tests it is wider: a click dispatched with dispatchEvent on a button inside a disabled fieldset still reaches React's onClick, because React only suppresses mouse events when the element's own disabled prop is set. Fix: add onClickCapture on the fieldset that calls stopPropagation (and preventDefault) while disabled; that blocks every descendant handler in browsers and in jsdom. Assert the native part in tests with el.matches(':disabled'), which jsdom resolves through the fieldset.
