Tooltips do not work on elements inside Shadow DOM
See original GitHub issueI’m trying to add a tooltip to a button that resides inside a shadow DOM. Unfortunately, does not work. I traced the problem down to this snippet of code inside bootstrap.js.
Tooltip.prototype.show = function show() {
var _this22 = this;
if ($(this.element).css('display') === 'none') {
throw new Error('Please use show on visible elements');
}
var showEvent = $.Event(this.constructor.Event.SHOW);
if (this.isWithContent() && this._isEnabled) {
if (this._isTransitioning) {
throw new Error('Tooltip is transitioning');
}
$(this.element).trigger(showEvent);
var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
if (showEvent.isDefaultPrevented() || !isInTheDom) {
return;
}
isInTheDom is false because jquery.contains doesn’t find the element, which I assume is because it resides inside the shadow DOM. If I manually set this value to true, the tooltip works perfectly. See my screenshot below.
To access my JSBin example, use the link below. http://jsbin.com/qukeye/2/edit?html,js,output
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
How to make JS tooltips work in Shadow DOM? - Stack Overflow
js https://popper.js.org/) are not working within the Shadow DOM at all. I have also tried to invoke tooltips directly with Popper.js and Tippy....
Read more >Issue 234100 in chromium: Tooltips in Shadow DOM don't work
1) tooltip of host element is displayed 2) if another tooltip is shown, the tooltip for ShadowDOM is displayed on the previous tooltip....
Read more >Tooltips · Bootstrap v5.0
Triggering tooltips on hidden elements will not work. Tooltips for .disabled or ... Tooltips can be triggered thanks to an element inside a...
Read more >Vue Tooltips - examples & tutorial. Bootstrap & Material Design
Triggering tooltips on hidden elements will not work. Tooltips for .disabled or ... Tooltips can be triggered thanks to an element inside a...
Read more >Bootstrap 5 Tooltips - AdminKit
Tooltips must be hidden before their corresponding elements have been removed from the DOM. Tooltips can be triggered thanks to an element inside...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @Johann-S, any updates on this? How long do approvals usually take?
No I have to do some rework and rebase my branch