Skip to content

Commit

Permalink
fix: keyboard navigation breaking
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
Jannik Stehle committed Jun 25, 2024
1 parent 813436c commit 5b24326
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 5b24326

Please sign in to comment.