-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function _isWithActiveTrigger in tooltip.js is causing an uncaught error #37474
Comments
Hello @njmkramer. Bug reports must include a live demo of the issue. Per our contributing guidelines, please create a reduced test case on CodePen or StackBlitz and report back with your link, Bootstrap version, and specific browser and Operating System details. |
Reduced test: https://js-cq37dw.stackblitz.io/ Focus as fast as you can different inputs and hover at the same time, enter a value, at some point the error will occur. |
Hi @julien-deramond, see my previous comment for reduced test/live demo. |
Hi @julien-deramond any progress on this issue? best regards |
Running into this as well.. |
As much as I 've tested till now, I cannot replicate the issue 😕 |
sorry to disappoint you, but this is not a fix, it is just a super defensive approach to save the situation of something really wrong (Tooltip is not initialized at all) I am here to help, but I will need your cooperation, in order to replicate the issue. I have tried to many times this example, without results. Please, create a codepen example to be able to follow your code, and try to explain me in simple bullets (steps) how to replicate. |
Thanxs for your reply, I wil updated the live test in the coming days |
Explaination: 1: from top to bottom: 2: from top to bottom: 3: from top to bottom: 4: repeat 1, 2 and 3 until the error comes up and it will Sometimes the error came up very quickly, other times I had to repeat the 4 steps serveral times, as fast as I could, to trigger the error to come up. I hope this helps you to see the problem |
can you please do it in a code pen in order to be able to see your code ? ( or provide an open project url for stackblitz) |
I'm seeing the same problem in Sentry from my Users, but I can also not reproduce it using the StackBlitz from @njmkramer, neither in Firefox (where I'm getting the User reports from) nor in Safari. |
url to the code: |
isWithActiveError.mp4screenshot of error occuring |
@GeoSot see screenshot where the error occurs. Best regards Norbert |
I'm experiencing the very same issue when using Bootstrap with Blazor and trying to navigate to another route (removes the elements from DOM) when the tooltip is still displayed: The Blazor code is as simple as follows: @inject NavigationManager NavigationManager
<HxButton Text="Navigate home"
Tooltip="Navigate"
Color="ThemeColor.Primary"
OnClick="@(() => NavigationManager.NavigateTo(""))" />
For now, I'm not trying to give you a regular repro, just adding some additional info to the issue. BTW: My original intention was to reproduce this issue (havit/Havit.Blazor#457): |
I am also experiencing this issue in I am using the Tooltips class in a It is also really difficult to replicate the error in my case but from the experimenting I've done, at the time of error
So this makes me think that in some way (that I still haven't managed to figure out):
from bootstrap.bundle.js:809
So I'm guessing the problem resides either in the Events management after the Tooltip instance is disposed of, or when it's re-instantiated on the same element after the previous instance was disposed of. |
simple live demo: https://codepen.io/alchimik-irk/pen/abapgLZ |
My friend, this is a wrong approach, as you are trying to dispose the tooltip instantly, not giving the proper time for the right approach on this is setTimeout( () =>{
tooltipEl.addEventListener('hidden.bs.tooltip', ()=> { tooltipBs.dispose() } )
tooltipBs.hide();
}, 2000); ref: #38018 |
That might be a wrong usage of the class but it is useful to reproduce the error consistently. In my case I'm using the I'm guessing that when the I think a failsafe in the |
Update: 1: start disposing 2: doing mouseover and mouseleave over the input with a popover error occurs: (2 sec. passed) I hope this helps in finding a solution for this nasty error. |
sreencast of error occuring during disposing and mouseover/mouseleave. popover-error.mp4 |
#36080 - same problem, with a solution, not merged |
same here |
Same issue here. My users also encounter this error (I have a logging system that logs user errors on the frontend), but I have never achieved to reproduce it on my side. Below are the user agents of my users devices who encountered this same issue:
Does anyone have any leads? Thanks |
I ran into the same issue, it occur when I call tooltip.dispose() in unmount of component in React, while I change it to call tooltip.hide(), it is ok and also meet my demand. |
@GeoSot Hi, when can i or we, expect a solution for this issue. |
I managed to find a workaround;
|
I ran into this error and because of the comments in this issue I was able to resolve it. In my scenario I wanted to change the title/position after the tooltip was initialised. I found that you can use lambdas instead to always get the latest values, like so: new Tooltip(this.element, {
"title": () => this.title,
"placement": () => this.placement
}); Now I only dispose the tooltip when the element gets destroyed. Update 7 September 2023: |
Here's a workaround: const disposePopover = popover => {
setTimeout(() => popover?.dispose(), 100)
} |
* Implement import log screen in Svelte * Show filename in import log screen title * Remove unused NoteRow property * Show number of imported notes * Use a single nid expression * Use 'count' as variable name for consistency * Import from @tslib/backend instead * Fix summary_template typing * Fix clippy warning * Apply suggestions from code review * Fix imports * Contents -> Fields * Increase max length of browser search bar https://github.com/ankitects/anki/pull/2568/files#r1255227035 * Fix race condition in Bootstrap tooltip destruction twbs/bootstrap#37474 * summary_template -> summaryTemplate * Make show link a button * Run import ops on Svelte side * Fix geometry not being restored in CSV Import page * Make VirtualTable fill available height * Keep CSV dialog modal * Reword importing-existing-notes-skipped * Avoid mentioning matching based on first field * Change tick and cross icons * List skipped notes last * Pure CSS spinner * Move set_wants_abort() call to relevant dialogs * Show number of imported cards * Remove bold from first sentence and indent summaries * Update UI after import operations * Add close button to import log page Also make virtual table react to resize event. * Fix typing * Make CSV dialog non-modal again Otherwise user can't interact with browser window. * Update window modality after import * Commit DB and update undo actions after import op * Split frontend proto into separate file, so backend can ignore it Currently the automatically-generated frontend RPC methods get placed in 'backend.js' with all the backend methods; we could optionally split them into a separate 'frontend.js' file in the future. * Migrate import_done from a bridgecmd to a HTTP request * Update plural form of importing-notes-added * Move import response handling to mediasrv * Move task callback to script section * Avoid unnecessary :global() * .log cannot be missing if result exists * Move import log search handling to mediasrv * Type common params of ImportLogDialog * Use else if * Remove console.log() * Add way to test apkg imports in new log screen * Remove unused import * Get actual card count for CSV imports * Use import type * Fix typing error * Ignore import log when checking for changes in Python layer * Apply suggestions from code review * Remove imported card count for now * Avoid non-null assertion in assignment * Change showInBrowser to take an array of notes * Use dataclasses for import log args * Simplify ResultWithChanges in TS * Only abort import when window is modal * Fix ResultWithChanges typing * Fix Rust warnings * Only log one duplicate per incoming note * Update wording about note updates * Remove caveat about found_notes * Reduce font size * Remove redundant map * Give credit to loading.io * Remove unused line --------- Co-authored-by: RumovZ <[email protected]>
I'm also having this issue, but it is quite random and I cannot provide a reproducible test case. It is indeed related to connect () {
this.tooltip = new Tooltip(this.element)
}
disconnect () {
this.tooltip.dispose()
}
Hovewer:
|
same issue |
I have the same issue using vueJs and tooltips with the "focus" trigger. I use a directive to manage the tooltips and I "fixed" the issue using : beforeUnmount: async (el) => {
const tooltip = bootstrap.Tooltip.getInstance(el);
if (tooltip) {
setTimeout(
() => tooltip.dispose(),
tooltip._config.trigger.includes("focus") ? 300 : 0,
);
}
}, |
I'm running into this issue via with a wrapped popover in an Ember component. This is the basic component code.
What's happening is in What I've had to do is to run hide in a setTimeout.
This way if the popover is disposed, the hide call won't do anything. It does feel like the hide |
I'm having same troubles with this environment: ASP.NET 4.6.2 - Bootstrap 5.3.3 - Jquery 3.7.1 - Bootstrap-Table 1.23.2 Problem is when i try to edit cell and update value (inside table and on database). For cell EDITING using bootstrap-editable.js with skycyclone-x-editable I use popup editing text-box. All is ok until application stores value in database. Event onEditableHidden is perfect and popup text disapperead well. A thing that i can't understand is that tooltip.js (inside browser inspector) is located in Bootstrap and Jquery Libraries are managed by Libman. In browser inspector i receive this error If anyone has a workaround.....
|
I am running into this issue when trying to use import { LitElement } from "lit";
import { Tooltip as BootstrapTooltip } from "bootstrap";
class Tooltip extends LitElement {
static properties = {
content: { type: String },
};
render() {
return html`<slot></slot>`;
}
connectedCallback() {
super.connectedCallback();
this._initializeTooltip();
}
disconnectedCallback() {
super.disconnectedCallback();
if (this._tooltip) {
this._tooltip.dispose();
}
}
async _initializeTooltip() {
await this.updateComplete;
const slot = this.shadowRoot.querySelector("slot");
const nodes = slot.assignedNodes({ flatten: true });
const triggerElement = nodes.find(
(node) => node.nodeType === Node.ELEMENT_NODE
);
this._tooltip = new BootstrapTooltip(triggerElement, {
title: this.content,
container: document.body,
});
}
}
customElements.define('my-tooltip', Tooltip); It is used like this to give a tooltip to a specific element
Normally this all works fine. However I have recently had some automated tests sporadically fail with this same I have been able to work around this for now by doing some hacky modification of the As @Andream98 and others have mentioned the documentation states that There is also a big warning in the documentation:
If I read this extremely literally I interpret this to mean that the |
* ensure `complete` handlers for `show` and `hide` check if the commponent was disposed * what can happen is the element can get removed from the DOM and the tooltip would get disposed * when the complete handler would run at a later point the component would be disposed and would throw various null related exceptions
Prerequisites
Describe the issue
This happens when multiple elements have a popover or a popover is attached to a new element and fast switching hover on elements.
Reduced test cases
suggestion:
What operating system(s) are you seeing the problem on?
Windows
What browser(s) are you seeing the problem on?
Chrome
What version of Bootstrap are you using?
v5.2.2
The text was updated successfully, but these errors were encountered: