🧩 HTML5: Fix a required Input Inside a Hidden Tab Blocking Submit
The constraint validation API blocks form submission for every required field unless the browser considers that element genuinely not rendered – and the spec’s bar for “not rendered” is narrower than most tabbed-form implementations assume. Hiding an inactive tab with visibility: hidden, or an aria-hidden wrapper that leaves display untouched, still counts as rendered, so a required field sitting on a tab the user never opened can silently block the entire form’s submit, with no visible validation message, because the browser tries to scroll to and focus a field the user can’t actually see.
🔎 The Problem
<div class="tab-panel" style="visibility: hidden;">
<label>Backup Email <input type="email" required></label>
</div>
<!-- visibility: hidden still counts as "rendered" for constraint
validation - the required field blocks submit even though the
user has never opened this tab -->
✅ Fix: Use display: none, or Toggle required With the Tab
- Use
display: none– notvisibility: hiddenand not an absolutely-positioned overlap – on the inactive tab panel, since constraint validation specifically skipsrequiredfields that aren’t rendered, anddisplay: noneis the only common hide technique that qualifies. - If a hidden tab’s fields only matter when that tab is active, toggle their
requiredattribute off when the tab is hidden and back on when it’s shown, instead of relying solely on a display technique to suppress validation. - Test submit with every tab left on something other than the first one – the bug by definition never shows up if your own manual testing always happens to submit from the tab that’s active by default.
🚨 Why This Is Dangerous
- A required field on a tab nobody opens can block every submission silently, with the only visible symptom being a form that “does nothing” when clicked – exactly the kind of bug that looks like a JavaScript error instead of a validation one.
The browser’s own validation only skips a required field it considers truly not rendered – and “the user can’t see it” isn’t always the same thing as that.

