Challenge - 5 Problems
Split Button Dropdown 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 split button dropdown code?
Look at the following HTML code using Bootstrap 5. What will you see rendered in the browser?
Bootsrap
<div class="btn-group"> <button type="button" class="btn btn-primary">Action</button> <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"> <span class="visually-hidden">Toggle Dropdown</span> </button> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="#">Option 1</a></li> <li><a class="dropdown-item" href="#">Option 2</a></li> </ul> </div>
Attempts:
2 left
💡 Hint
Remember that split button dropdowns have a main action button and a separate toggle button for the dropdown.
✗ Incorrect
The split button dropdown consists of a main button labeled 'Action' and a smaller toggle button with a downward arrow. Clicking the arrow opens the dropdown menu with the listed options.
❓ accessibility
intermediate1:30remaining
Which attribute improves accessibility for the split button dropdown toggle?
In a Bootstrap split button dropdown, which attribute on the toggle button helps screen readers understand its purpose?
Bootsrap
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"> <span class="visually-hidden">Toggle Dropdown</span> </button>
Attempts:
2 left
💡 Hint
This attribute tells if the dropdown is open or closed.
✗ Incorrect
The aria-expanded attribute indicates whether the dropdown menu is currently expanded (open) or collapsed (closed), which helps screen readers convey the toggle state.
📝 Syntax
advanced1:30remaining
What error occurs if you omit the dropdown menu container in a split button dropdown?
Consider this Bootstrap split button dropdown code missing the dropdown menu
- element. What happens when you click the toggle button?
Bootsrap
<div class="btn-group"> <button type="button" class="btn btn-primary">Action</button> <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"> <span class="visually-hidden">Toggle Dropdown</span> </button> </div>
Attempts:
2 left
💡 Hint
Bootstrap requires a dropdown menu container to show the menu.
✗ Incorrect
Without the dropdown menu container, clicking the toggle button triggers no visible dropdown because there is no menu to show. No error is thrown, but the toggle is ineffective.
❓ selector
advanced1:30remaining
Which CSS selector targets only the toggle button in a Bootstrap split button dropdown?
Given this HTML structure, which CSS selector applies styles only to the toggle button (the smaller arrow button)?
Bootsrap
<div class="btn-group"> <button type="button" class="btn btn-primary">Action</button> <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown"></button> </div>
Attempts:
2 left
💡 Hint
Look for the unique class that identifies the toggle button.
✗ Incorrect
The toggle button has the class 'dropdown-toggle-split' which uniquely identifies it. The selector '.btn-group > .dropdown-toggle-split' targets only that button.
🧠 Conceptual
expert2:00remaining
Why use a split button dropdown instead of a single dropdown button?
What is the main advantage of using a split button dropdown in a user interface?
Attempts:
2 left
💡 Hint
Think about user speed and clarity in choosing actions.
✗ Incorrect
Split button dropdowns let users quickly perform the main action by clicking the main button, while still providing access to other related options via the dropdown toggle. This improves usability and efficiency.