fix: toggle focus click and kbd (#881)

This commit is contained in:
Judicael 2022-08-04 17:34:47 +03:00 committed by GitHub
parent b7231d2bd5
commit 7fce946428
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,6 +10,7 @@ export function useKeyboardShortcuts(ref: React.RefObject<HTMLDivElement>) {
(ignoreMenus = false) => { (ignoreMenus = false) => {
const elm = ref.current const elm = ref.current
if (ignoreMenus && (app.isMenuOpen || app.settings.keepStyleMenuOpen)) return true if (ignoreMenus && (app.isMenuOpen || app.settings.keepStyleMenuOpen)) return true
elm?.focus()
return elm && (document.activeElement === elm || elm.contains(document.activeElement)) return elm && (document.activeElement === elm || elm.contains(document.activeElement))
}, },
[ref] [ref]