You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every tooltip adds a keydown event listener to the window.
I tested this on both Firefox and Chrome and its the same problem.
Removing the tooltips also removes these listeners.
Reproduction
Add the Tooltip component multiple times.
You will notice that a new event listener for keydown is added to the window every time you add a Tooltip.
I would assume that using one event listener and then sending to every tooltip component is out of the question, because of how these components are setup. But my thinking was that so many event listeners all listening to keydown would just use unnecessary resources. I could be overthinking this, and having so many event listeners is fine, but I just wanted to make sure that is the case.
Another option could be attaching the event listener to the parent of the tooltip, for example if the tooltip is attached to a button, then attach the event listener to the button.
A lot of JS frameworks work by delegating events to the document, even Svelte in the new version. I don't think it's an issue :)
Attaching to the button is not feasible for this specific listener, as it detects mouse position to see if we should close the tooltip. We don't close it even if its outside the button, as long as its between the button and the content.
Describe the bug
Every tooltip adds a keydown event listener to the window.
I tested this on both Firefox and Chrome and its the same problem.
Removing the tooltips also removes these listeners.
Reproduction
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: