CKTIS / HTML
aria-required — semantic requiredness
`aria-required` communicates that a supported control requires a value but adds no native form constraint.
Version: WAI-ARIA 1.2
Syntax
<input aria-required="true">String values are true and false; the default declares no requiredness through ARIA. Also provide a visible indication and a clear label, not color alone.
For native fields prefer HTML required, which also supplies browser validation. ARIA alone blocks neither an empty value nor submission. A custom control needs validation logic, and the server must still check input. ARIA state does not disable an existing HTML constraint.
The example first checks an empty field marked only with ARIA: it is natively valid. Adding native requiredness makes checkValidity() false. The test verifies both results and required semantics in the accessibility tree.
Examples
<!doctype html><meta charset="utf-8">
<label for="name">Name</label><input id="name" aria-required="true">
<output id="result"></output>
<script>
const input = document.querySelector('#name');
const ariaOnly = input.checkValidity();
input.required = true;
document.querySelector('#result').textContent = 'ariaOnly=' + ariaOnly + '; nativeRequired=' + input.checkValidity();
</script>Result
ariaOnly=true; nativeRequired=false
Compared two distinct requiredness mechanisms without submitting a form or data to a server.