Skip to content

Commit

Permalink
Merge pull request #5329 from nextcloud/backport/5327/stable28
Browse files Browse the repository at this point in the history
[stable28] fix: Only unpause focus traps that we paused ourselves
  • Loading branch information
juliushaertl committed Feb 1, 2024
2 parents 907fc11 + 68fe042 commit 89c3573
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 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]
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 89c3573

Please sign in to comment.