fix(tooltip): match data-sys-tooltip on subsequent hovers

After first hover, title is stripped and stored as data-sys-tooltip.
Subsequent hovers need to match [data-sys-tooltip] since [title] no
longer exists on the element.
This commit is contained in:
vicrodh committed 2026-02-08 12:47:49 -06:00
1 parent 969f2ba71c
commit 6b20355737
1 file changed
+6 -1
+6 -1
View File
@@ -29,9 +29,14 @@
});
function handleEnter(e: PointerEvent) {
const el = (e.target as HTMLElement)?.closest?.('[title]') as HTMLElement | null;
const target = e.target as HTMLElement;
if (!target?.closest) return;
// Match elements with title (first hover) or data-sys-tooltip (subsequent hovers)
const el = (target.closest('[title]') || target.closest('[data-sys-tooltip]')) as HTMLElement | null;
if (!el) return;
// On first hover, migrate title → data-sys-tooltip
const titleText = el.getAttribute('title');
if (titleText) {
el.setAttribute('data-sys-tooltip', titleText);