Skip to content

Commit

Permalink
fix: keyboard navigation breaking (#11099)
Browse files Browse the repository at this point in the history
Fixes the keyboard navigation breaking in certain scenarios.

The issue was that `window.getSelection()` would not always return the currently focused element when checking if we need to disable our custom keybindings. So e.g. when clicking the search input and then clicking a file in the file list, the focused element would still be the search input, leading to our keybindings not working.
  • Loading branch information
JammingBen authored Jul 2, 2024
1 parent 5efd63e commit 2b1000c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-keyboard-navigation-breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Keyboard navigation breaking

We've fixed a bug where the keyboard navigation would break in certain scenarios, e.g. when opening a folder from the search results.

https://github.com/owncloud/web/issues/10942
https://github.com/owncloud/web/pull/11099
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ const areCustomKeyBindingsDisabled = () => {
) {
return true
}
const closestSelectionEl = window.getSelection().focusNode as HTMLElement
const closestSelectionEl = document.activeElement
if (!closestSelectionEl) {
return false
}
let customKeyBindings
let customKeyBindings: Element
try {
customKeyBindings = closestSelectionEl?.closest("[data-custom-key-bindings-disabled='true']")
} catch {
Expand Down

0 comments on commit 2b1000c

Please sign in to comment.