Skip to content

Commit

Permalink
fix: Only unpause focus traps that we paused ourselves
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl authored and backportbot[bot] committed Feb 1, 2024
1 parent 5bfd082 commit 68fe042
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/extensions/FocusTrap.js
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -10,8 +12,12 @@ const toggleFocusTrap = ({ editor }) => {

if (possibleEditorTabCommand) {
activeTrap?.pause()
ownPaused = true
} else {
activeTrap?.unpause()
if (ownPaused) {
ownPaused = false
activeTrap?.unpause()
}
}
}

Expand Down

0 comments on commit 68fe042

Please sign in to comment.