All practice problems Bug of the Day: a new problem every midnight, free for everyone. Keep a streak with your friends.
Frontend Engineering · HTML & CSS · Hard
HTML & CSS practice: The Modal Mess
A keyboard user got trapped in the ChaiClub popup. Mr. Bansal is mortified. A customer who uses only a keyboard says our ChaiClub popup “ate” her. Her…
The problem
- A customer who uses only a keyboard says our ChaiClub popup “ate” her. Her screen reader didn't even say it was a popup.
- • The popup must be announced as a dialog, with its title.
- • The × must work as a Close button — and say “Close”, not “times”.
- • “Join now” must work with the keyboard.
- Must pass: Popup is announced as a dialog.
- Must pass: Dialog announces its title.
- Must pass: Close is a real button named “Close”.
- Must pass: “Join now” works with the keyboard.
You'll use: HTML · CSS · Accessibility · Responsive design · Forms
Solve it (expert level)3–6 min · You write HTML & CSS
Show a hint
Dialogs need role="dialog" and aria-modal="true", plus aria-labelledby pointing at the title's id.
What this teaches (spoiler)
Dialogs need the right semantics to be usable: a dialog role with aria-modal, an accessible name from its title, real buttons, and comfortably sized close targets.