A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
<style>input[aria-invalid="true"] { border-color:#b91c1c; }</style><main class="demo"><label>Example field <input class="demo-input" type="text"/></label></main>
Engineering judgment: Use ARIA state attributes as styling hooks only when the underlying semantics are correct; CSS should reflect state, not invent it.
In production, Color alone is not enough to communicate validation. Pair borders with text, icons, or status messaging and preserve the programmatic relationships in HTML. That is the kind of bug that survives visual spot checks because the stylesheet is syntactically valid while the layout contract is wrong.
| Concern | What to inspect | Typical failure |
|---|---|---|
| Core behavior | Validation States and Accessible Form Styling | Color alone is not enough to communicate validation. Pair borders with text, icons, or status messaging and preserve the programmatic relationships in HTML. |
| Production test | Real content and constraints | The rule works only for the demo values |
| Maintenance | Scope and override path | A later fix creates another exception |
A good CSS change narrows the problem. Use ARIA state attributes as styling hooks only when the underlying semantics are correct; CSS should reflect state, not invent it. This keeps the rule understandable when content, theme, or viewport conditions change later.
<style>.field[aria-invalid="true"]::after { content:"!"; }</style><main class="field">Example content</main>
In production, Color alone is not enough to communicate validation. Pair borders with text, icons, or status messaging and preserve the programmatic relationships in HTML. That is the kind of bug that survives visual spot checks because the stylesheet is syntactically valid while the layout contract is wrong.
<style>.required::after { content:" *"; }</style><main class="required">Example content</main>
Required cue is useful here because it demonstrates validation states and accessible form styling under a concrete input rather than as an abstract property list.
<style>input[aria-invalid="false"] { border-color:#15803d; }</style><main class="demo"><label>Example field <input class="demo-input" type="text"/></label></main>
Success border is useful here because it demonstrates validation states and accessible form styling under a concrete input rather than as an abstract property list.
Finish the lesson once you have worked through the material. This awards ★ 30 XP.