🧩 Fix a Required Field Skipping Screen Reader Focus
When native HTML5 constraint validation finds an invalid required field on submit, the browser’s standard behavior is to move focus to it and report the problem – but a display:none element can never receive focus at all, by design. In a multi-step wizard where only the current step is shown and every other step is hidden purely with CSS (display:none) rather than the hidden attribute, a required field left behind in an earlier step is still part of the form and still gets validated on submit, but the browser’s attempt to focus it on failure is a silent no-op: no scroll, no focus ring, no screen reader announcement, and the form simply never submits.
🔎 The Problem
<form>
<section data-step="1">...</section>
<section data-step="2" style="display:none;">
<label for="phone">Phone</label>
<input id="phone" required>
</section>
<button type="submit">Submit</button>
</form>
<!-- Clicking Submit while step 2 is still display:none: -->
<!-- Chrome/Firefox/Safari constraint validation finds #phone invalid, -->
<!-- but a display:none element cannot receive focus, so focus() is a -->
<!-- silent no-op - no scroll, no focus ring, no screen reader -->
<!-- announcement, and the form simply does not submit -->
✅ Fix: Hide Steps With the hidden Attribute
- Give every step section other than the currently visible one the hidden attribute (or disable its inputs) instead of relying on display:none alone – a hidden or disabled field is excluded from constraint validation entirely, so the browser never tries to focus it in the first place.
- On each step change in the wizard’s own JavaScript, toggle required off on fields outside the active step and back on when that step becomes current, so validation only ever considers fields the user can currently see and interact with.
- Test the multi-step flow with a screen reader, or at minimum with the keyboard alone watching for visible focus, after any change to which attribute hides a step – display:none and the hidden attribute look identical visually but behave completely differently for focus and validation.
🚨 Why This Is Dangerous
A submit button that silently does nothing, with no validation message, no focus movement, and nothing announced to assistive technology, is indistinguishable from a broken form – a screen reader user has no way to discover that the real problem is an invisible required field two steps back.
The browser’s native validation is only as accessible as the DOM state it’s validating against – a field it can’t focus is a field it also can’t tell anyone about.




