0
0
Bootsrapmarkup~20 mins

Popover component in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Popover Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What triggers a Bootstrap popover by default?
Bootstrap popovers can be triggered by different user actions. By default, which user action triggers a popover to appear?
AClicking the element
BHovering over the element
CFocusing the element
DDouble-clicking the element
Attempts:
2 left
💡 Hint
Think about the most common way users interact with buttons or links to see extra info.
📝 Syntax
intermediate
2:00remaining
Which code correctly initializes a popover with a custom title and content?
You want to create a popover on a button with the title 'Info' and content 'More details here'. Which code snippet correctly initializes this popover using Bootstrap's JavaScript API?
Bootsrap
<button id="infoBtn" type="button" class="btn btn-primary">Info</button>
Abootstrap.Popover.init(document.getElementById('infoBtn'), {title: 'Info', content: 'More details here'});
Bnew bootstrap.Popover('#infoBtn', {header: 'Info', body: 'More details here'});
Cnew bootstrap.Popover(document.getElementById('infoBtn'), {title: 'Info', content: 'More details here'});
Dnew Popover(document.getElementById('infoBtn'), {titleText: 'Info', contentText: 'More details here'});
Attempts:
2 left
💡 Hint
Check the correct constructor name and option keys for title and content.
rendering
advanced
2:00remaining
What is the visual result of this popover placement code?
Given the following HTML and JavaScript, where will the popover appear relative to the button when clicked?
Bootsrap
<button id="btn" type="button" class="btn btn-secondary" data-bs-toggle="popover" data-bs-placement="left" data-bs-content="Popover on left">Click me</button>
<script>var popoverTrigger = document.getElementById('btn');
var popover = new bootstrap.Popover(popoverTrigger);</script>
AThe popover appears to the left side of the button.
BThe popover appears to the right side of the button.
CThe popover appears above the button.
DThe popover appears below the button.
Attempts:
2 left
💡 Hint
Look at the data-bs-placement attribute value.
accessibility
advanced
2:00remaining
Which attribute improves accessibility for Bootstrap popovers?
To make popovers accessible for screen readers, which ARIA attribute should be added to the popover trigger element?
Aaria-expanded="true"
Baria-haspopup="true"
Caria-label="popover content"
Daria-live="polite"
Attempts:
2 left
💡 Hint
This attribute indicates the element controls a popup.
selector
expert
2:00remaining
Which CSS selector targets only visible Bootstrap popovers?
Bootstrap popovers have the class .popover. You want to write CSS that styles only popovers currently visible on the page. Which selector correctly targets visible popovers?
A.popover:not(.fade) { background-color: yellow; }
B.popover[aria-hidden="false"] { background-color: yellow; }
C.popover:visible { background-color: yellow; }
D.popover.show { background-color: yellow; }
Attempts:
2 left
💡 Hint
Bootstrap adds a specific class to show popovers.