From 68fe0420474ed8f17c7e36b0bffea37e0f3fb57b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 31 Jan 2024 16:36:44 +0100 Subject: [PATCH] fix: Only unpause focus traps that we paused ourselves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/extensions/FocusTrap.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/extensions/FocusTrap.js b/src/extensions/FocusTrap.js index 66180244065..1856f4d2ee6 100644 --- a/src/extensions/FocusTrap.js +++ b/src/extensions/FocusTrap.js @@ -1,5 +1,7 @@ import { Extension } from '@tiptap/core' +let ownPaused = false + const toggleFocusTrap = ({ editor }) => { const trapStack = window._nc_focus_trap ?? [] const activeTrap = trapStack[trapStack.length - 1] @@ -10,8 +12,12 @@ const toggleFocusTrap = ({ editor }) => { if (possibleEditorTabCommand) { activeTrap?.pause() + ownPaused = true } else { - activeTrap?.unpause() + if (ownPaused) { + ownPaused = false + activeTrap?.unpause() + } } }