0
0
Bootsrapmarkup~20 mins

Split button dropdowns in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Split Button Dropdown Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2: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>
AA blue button labeled 'Action' with a disabled dropdown arrow next to it.
BA single blue button labeled 'Action' that opens a dropdown with 'Option 1' and 'Option 2' when clicked.
CA blue button labeled 'Action' next to a smaller blue button with a downward arrow that opens a dropdown with 'Option 1' and 'Option 2'.
DTwo separate blue buttons labeled 'Action' and 'Toggle Dropdown' with no dropdown menu.
Attempts:
2 left
💡 Hint
Remember that split button dropdowns have a main action button and a separate toggle button for the dropdown.
accessibility
intermediate
1: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>
Aaria-expanded="false"
Baria-hidden="true"
Caria-label="Toggle Dropdown"
Daria-pressed="true"
Attempts:
2 left
💡 Hint
This attribute tells if the dropdown is open or closed.
📝 Syntax
advanced
1: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>
AA JavaScript error is thrown: 'Cannot read property of undefined'.
BThe dropdown toggle button does nothing; no menu appears.
CThe page crashes and reloads automatically.
DThe toggle button opens an empty dropdown menu.
Attempts:
2 left
💡 Hint
Bootstrap requires a dropdown menu container to show the menu.
selector
advanced
1: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>
A.btn-group > button:last-child:not(.dropdown-toggle-split)
B.btn-group > .btn-primary
C.btn-group > button:first-child
D.btn-group > .dropdown-toggle-split
Attempts:
2 left
💡 Hint
Look for the unique class that identifies the toggle button.
🧠 Conceptual
expert
2: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?
AIt separates the main action from additional options, allowing quick access to the default action without opening the menu.
BIt disables the main button when the dropdown is open to prevent accidental clicks.
CIt reduces the number of buttons on the page by combining unrelated actions.
DIt automatically selects the first dropdown item as the main action without user input.
Attempts:
2 left
💡 Hint
Think about user speed and clarity in choosing actions.