From 1ceaafc63fd449558b2404c8b1982938534e39ca Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Fri, 16 Dec 2022 14:56:03 +0300 Subject: [PATCH] fix(panel): fix panel close routine if it was closed immediately fixes #4108 --- src/core/components/panel/panel-class.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/components/panel/panel-class.js b/src/core/components/panel/panel-class.js index a540359c80..62af44d5a0 100644 --- a/src/core/components/panel/panel-class.js +++ b/src/core/components/panel/panel-class.js @@ -288,6 +288,8 @@ class Panel extends Framework7Class { onOpen(modifyHtmlClasses = true) { const panel = this; + // eslint-disable-next-line + panel._openTimeStamp = new Date().getTime(); const app = panel.app; panel.opened = true; @@ -472,7 +474,6 @@ class Panel extends Framework7Class { close(animate = true) { const panel = this; - const { effect, $el, $backdropEl, opened, $containerEl } = panel; if (!opened || $el.hasClass('panel-in-breakpoint') || !$el.hasClass('panel-in')) return panel; @@ -486,6 +487,12 @@ class Panel extends Framework7Class { $viewEl.add($containerEl.children('.page-content, .tabs')); } const transitionEndTarget = effect === 'reveal' ? $viewEl : $el; + // eslint-disable-next-line + const openTimeDiff = new Date().getTime() - panel._openTimeStamp; + if (openTimeDiff < 16) { + // eslint-disable-next-line + animate = false; + } function transitionEnd() { if ($el.hasClass('panel-out')) {