Challenge - 5 Problems
Toast Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
What is the visual output of this Bootstrap toast code?
Look at the following Bootstrap toast HTML snippet. What will you see rendered in the browser?
Bootsrap
<div class="toast show" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-header"> <strong class="me-auto">Notification</strong> <small>11 mins ago</small> <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> </div> <div class="toast-body"> Hello, this is a toast message! </div> </div>
Attempts:
2 left
💡 Hint
Check the class 'show' and the structure of the toast component.
✗ Incorrect
The 'toast' div with class 'show' makes the toast visible. The header contains the title, timestamp, and close button. The body shows the message. This creates a small popup box on the page.
📝 Syntax
intermediate2:00remaining
Which option correctly initializes a Bootstrap toast with JavaScript?
You want to show a Bootstrap toast using JavaScript. Which code snippet correctly creates and shows the toast?
Bootsrap
const toastEl = document.getElementById('myToast');Attempts:
2 left
💡 Hint
Bootstrap's JavaScript API uses 'new bootstrap.Toast(element)'.
✗ Incorrect
The correct syntax is 'new bootstrap.Toast(element)' to create a toast instance, then call 'show()' to display it. Other options have wrong capitalization or method names.
❓ accessibility
advanced2:00remaining
Which ARIA attributes make Bootstrap toasts accessible?
Bootstrap toasts use ARIA attributes to help screen readers. Which set of attributes is correct for a toast container?
Attempts:
2 left
💡 Hint
Toasts announce messages immediately and fully to assistive tech.
✗ Incorrect
The toast container uses role="alert" to announce urgent messages, aria-live="assertive" to notify immediately, and aria-atomic="true" to read the entire message. Other options use incorrect roles or aria-live values.
❓ layout
advanced2:00remaining
How to position multiple Bootstrap toasts stacked at the bottom right corner?
You want multiple toasts stacked vertically at the bottom right corner of the screen. Which CSS and HTML setup achieves this?
Bootsrap
<div id="toastContainer" aria-live="polite" aria-atomic="true" class="position-fixed bottom-0 end-0 p-3"> <!-- Toasts go here --> </div>
Attempts:
2 left
💡 Hint
Bootstrap utilities for fixed positioning and padding help place toasts.
✗ Incorrect
The container with 'position-fixed bottom-0 end-0 p-3' fixes it to bottom right with padding. Toasts inside stack vertically by default. Other options place toasts elsewhere or use deprecated classes.
🧠 Conceptual
expert3:00remaining
What happens if you omit the 'aria-atomic' attribute on a Bootstrap toast?
Consider a toast with role="alert" and aria-live="assertive" but no aria-atomic attribute. What is the likely effect on screen readers?
Attempts:
2 left
💡 Hint
aria-atomic controls whether the entire region is read or only changed parts.
✗ Incorrect
Without aria-atomic="true", screen readers may read only changed parts of the toast, leading to partial or confusing announcements. This attribute ensures the entire message is read at once.