                    }
                });

                el.addEventListener('mouseleave', () => {
                    if (currentTarget === el) {
                        removeTooltip();
                    }
                });

                el.addEventListener('click', () => {
                    if (!isElementVisible(el) && currentTarget === el) {
                        removeTooltip();
                    }
                });
            });

            document.addEventListener('mouseover', e 