@rogieking/figui3 6.20.1 → 6.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fig.js +10 -10
- package/fig.js +19 -2
- package/package.json +1 -1
package/fig.js
CHANGED
|
@@ -834,6 +834,9 @@ customElements.define("fig-dropdown", FigDropdown);
|
|
|
834
834
|
* @attr {string} theme - Optional theme passed to the underlying popup (e.g. "brand").
|
|
835
835
|
* @attr {string} pointer - "false" to hide the beak.
|
|
836
836
|
* @attr {boolean} show - When set, force-show the tooltip (ignores hide).
|
|
837
|
+
*
|
|
838
|
+
* Call {@link FigTooltip.dismissHoverTooltips} when opening menus/dialogs so
|
|
839
|
+
* hover tips do not stay visible over interactive overlays.
|
|
837
840
|
*/
|
|
838
841
|
class FigTooltip extends HTMLElement {
|
|
839
842
|
static #lastShownAt = 0;
|
|
@@ -1331,7 +1334,7 @@ class FigTooltip extends HTMLElement {
|
|
|
1331
1334
|
FigTooltip.#documentExitListenersReady = true;
|
|
1332
1335
|
|
|
1333
1336
|
const handlePointerLeftDocument = () => {
|
|
1334
|
-
FigTooltip
|
|
1337
|
+
FigTooltip.dismissHoverTooltips();
|
|
1335
1338
|
};
|
|
1336
1339
|
const handleViewportChange = () => {
|
|
1337
1340
|
FigTooltip.#dismissTooltipsOnViewportChange();
|
|
@@ -1372,13 +1375,20 @@ class FigTooltip extends HTMLElement {
|
|
|
1372
1375
|
});
|
|
1373
1376
|
}
|
|
1374
1377
|
|
|
1375
|
-
|
|
1378
|
+
/**
|
|
1379
|
+
* Dismiss open/pending hover tooltips and programmatic {@link FigTooltip.show} tips.
|
|
1380
|
+
* Skips `show`-persisted and `action="click"` tooltips. Call when opening menus/dialogs.
|
|
1381
|
+
*/
|
|
1382
|
+
static dismissHoverTooltips() {
|
|
1376
1383
|
for (const node of document.querySelectorAll("fig-tooltip")) {
|
|
1377
1384
|
if (!(node instanceof FigTooltip)) continue;
|
|
1378
1385
|
if (node.action !== "hover") continue;
|
|
1379
1386
|
if (node.#showPersisted) continue;
|
|
1380
1387
|
if (node.isOpen || node.timeout) node.hidePopup();
|
|
1381
1388
|
}
|
|
1389
|
+
for (const anchor of Array.from(FigTooltip.#programmaticAnchors)) {
|
|
1390
|
+
FigTooltip.hide(anchor);
|
|
1391
|
+
}
|
|
1382
1392
|
}
|
|
1383
1393
|
|
|
1384
1394
|
static #programmatic = new WeakMap();
|
|
@@ -1660,6 +1670,7 @@ class FigDialog extends HTMLDialogElement {
|
|
|
1660
1670
|
// other FigUI overlays (same helper as fig-popup).
|
|
1661
1671
|
this._assignStackingOrder();
|
|
1662
1672
|
this.addEventListener("close", this._boundRestoreFocus, { once: true });
|
|
1673
|
+
FigTooltip.dismissHoverTooltips();
|
|
1663
1674
|
return super.show();
|
|
1664
1675
|
}
|
|
1665
1676
|
|
|
@@ -1668,6 +1679,7 @@ class FigDialog extends HTMLDialogElement {
|
|
|
1668
1679
|
// Top layer owns stacking; clear any prior non-modal inline z-index.
|
|
1669
1680
|
this._clearStackingOrder();
|
|
1670
1681
|
this.addEventListener("close", this._boundRestoreFocus, { once: true });
|
|
1682
|
+
FigTooltip.dismissHoverTooltips();
|
|
1671
1683
|
return super.showModal();
|
|
1672
1684
|
}
|
|
1673
1685
|
|
|
@@ -2651,6 +2663,11 @@ class FigPopup extends HTMLDialogElement {
|
|
|
2651
2663
|
|
|
2652
2664
|
const anchor = this.resolveAnchor();
|
|
2653
2665
|
if (anchor?.classList) anchor.classList.add("has-popup-open");
|
|
2666
|
+
|
|
2667
|
+
// Tooltips lose to interactive overlays (menus, selects, popovers).
|
|
2668
|
+
if (this.getAttribute("variant") !== "tooltip") {
|
|
2669
|
+
FigTooltip.dismissHoverTooltips();
|
|
2670
|
+
}
|
|
2654
2671
|
}
|
|
2655
2672
|
|
|
2656
2673
|
hidePopup() {
|
package/package.json
CHANGED