Challenge - 5 Problems
Alert Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
Rendering a success alert with Tailwind CSS
Which option correctly renders a green success alert with accessible roles and proper padding using Tailwind CSS?
Attempts:
2 left
💡 Hint
Look for the option that uses role="alert" and includes padding and border classes for a clear alert box.
✗ Incorrect
Option C uses role="alert" for screen readers, includes padding (px-4 py-3), border with color, background, and text colors for a clear success alert. It also uses aria-live="polite" for accessibility. Other options miss some accessibility or styling details.
❓ selector
intermediate2:00remaining
Selecting the correct Tailwind class for a dismissible alert close button
Which Tailwind CSS class combination is best for a close button inside an alert to ensure it is keyboard accessible and visually clear?
Attempts:
2 left
💡 Hint
Focus styles help keyboard users see the button is focused.
✗ Incorrect
Option A includes focus outlines and ring styles for keyboard accessibility, plus hover color changes for clarity. Others miss focus styles or have insufficient padding.
🧠 Conceptual
advanced1:30remaining
Understanding ARIA roles in alert notifications
What is the main purpose of adding
role="alert" to an alert notification in HTML?Attempts:
2 left
💡 Hint
Think about how screen readers handle urgent messages.
✗ Incorrect
role="alert" tells screen readers to announce the content immediately as a live region. It does not affect styling or delay announcements.
❓ layout
advanced2:30remaining
Creating a responsive notification banner with Tailwind CSS
Which option correctly uses Tailwind CSS to create a notification banner that is horizontally centered, has space between icon and text, and stacks vertically on small screens?
Attempts:
2 left
💡 Hint
Use flex direction column by default (small screens) and row on larger screens (sm:).
✗ Incorrect
Option A uses flex-col by default (vertical stack on small screens) and switches to flex-row on larger screens (sm:flex-row). It centers items and adds gap for spacing. Others miss the responsive stacking or use fixed directions.
❓ accessibility
expert3:00remaining
Ensuring accessible live region updates for dynamic alerts
You have a notification area that updates dynamically with new alerts. Which ARIA attribute combination ensures screen readers announce new alerts only when they appear, without repeating old alerts?
Attempts:
2 left
💡 Hint
Consider polite announcements and whole region updates.
✗ Incorrect
aria-live="polite" lets screen readers announce updates without interrupting. aria-atomic="true" ensures the entire alert content is read, preventing partial repeats. Other options either interrupt too aggressively, don't announce, or may cause partial announcements.