0
0
Bootsrapmarkup~20 mins

Tooltip component in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Tooltip Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
How does Bootstrap initialize tooltips?
Bootstrap tooltips require JavaScript to work. Which of the following is the correct way to initialize all tooltips on a page using Bootstrap 5?
A
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
  return new bootstrap.Tooltip(tooltipTriggerEl);
});
Bvar tooltipList = Array.from(document.querySelectorAll('[data-toggle="tooltip"]')).map(el => new bootstrap.Tooltip(el));
Cbootstrap.Tooltip.initAll();
Dnew bootstrap.Tooltip(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
Attempts:
2 left
💡 Hint
Look for the official Bootstrap 5 way to initialize multiple tooltips using JavaScript.
📝 Syntax
intermediate
2:00remaining
Identify the syntax error in this tooltip HTML
Which option contains a syntax error that prevents the tooltip from working correctly?
Bootsrap
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" title="Tooltip on top">Hover me</button>
A<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" title=Tooltip on top>Hover me</button>
B<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-bs-placement="top" title="Tooltip on top">Hover me</button>
C<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" title="Tooltip on top">Hover me</button>
D<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" title='Tooltip on top'>Hover me</button>
Attempts:
2 left
💡 Hint
Check how the title attribute value is written in HTML.
rendering
advanced
2:00remaining
What is the visual result of this tooltip placement?
Given this button with a tooltip, where will the tooltip appear relative to the button when hovered?
Bootsrap
<button type="button" class="btn btn-primary" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Tooltip below">Hover me</button>
AThe tooltip appears above the button.
BThe tooltip appears to the right of the button.
CThe tooltip appears to the left of the button.
DThe tooltip appears below the button.
Attempts:
2 left
💡 Hint
Look at the value of the data-bs-placement attribute.
selector
advanced
2:00remaining
Which CSS selector targets only active tooltips?
Bootstrap tooltips add the class show when visible. Which CSS selector correctly styles only visible tooltips?
A.tooltip[visible]
B.tooltip.show
C.tooltip.active
D.tooltip:visible
Attempts:
2 left
💡 Hint
Bootstrap toggles the show class to control visibility.
accessibility
expert
3:00remaining
How to make Bootstrap tooltips accessible to keyboard users?
Which practice improves accessibility for Bootstrap tooltips so keyboard users can also see the tooltip content?
AAdd <code>aria-hidden="true"</code> to the tooltip content to hide it from screen readers.
BUse only mouse events to show tooltips, ignoring keyboard focus.
CAdd <code>tabindex="0"</code> to the tooltip trigger element and ensure tooltips appear on focus as well as hover.
DRemove the <code>title</code> attribute and rely only on visual tooltips.
Attempts:
2 left
💡 Hint
Think about how keyboard users navigate and how screen readers announce content.