From 69eb2866d5d47e9152189a452ee141f11731046d Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Thu, 18 Jan 2024 16:20:18 +1100 Subject: [PATCH] fix(panel): queue panel close after peek animation ends if no longer hovering --- src/core/islands/Panel.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/islands/Panel.mjs b/src/core/islands/Panel.mjs index 0911918..ccc6a01 100644 --- a/src/core/islands/Panel.mjs +++ b/src/core/islands/Panel.mjs @@ -301,6 +301,12 @@ function Panel({ if (isPeeked() || !panelViews.length) return; if (isClosed()) Object.assign(animationState, peekAnimation); animatePanel({ ...openWidth, ...peekAnimation }); + // closing on mouseout is disabled mid-animation, + // queue close in case mouse is no longer peeking + // after the initial animation is complete + setTimeout(() => { + if (!isDragging() && !$panel.matches(":hover")) $panel.close(); + }, transitionDuration); $panel.removeAttribute("data-pinned"); $panel.dataset.peeked = true; setInteractive(true);