Skip to content

Commit

Permalink
Merge pull request #5327 from nextcloud/bugfix/5326
Browse files Browse the repository at this point in the history
fix: Only unpause focus traps that we paused ourselves
  • Loading branch information
juliusknorr authored Feb 1, 2024
2 parents 43c4512 + c22d700 commit 43f8a38
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 43f8a38

Please sign in to comment.