fix: some keyboard shortcuts not working in non-english (#2324)
This commit is contained in:
parent
e9f274f304
commit
1fe598f554
|
@ -4,6 +4,7 @@ import { useMagicSequence } from '~/composables/magickeys'
|
||||||
export default defineNuxtPlugin(({ $scrollToTop }) => {
|
export default defineNuxtPlugin(({ $scrollToTop }) => {
|
||||||
const keys = useMagicKeys()
|
const keys = useMagicKeys()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const i18n = useNuxtApp().$i18n
|
||||||
|
|
||||||
// disable shortcuts when focused on inputs (https://vueuse.org/core/usemagickeys/#conditionally-disable)
|
// disable shortcuts when focused on inputs (https://vueuse.org/core/usemagickeys/#conditionally-disable)
|
||||||
const activeElement = useActiveElement()
|
const activeElement = useActiveElement()
|
||||||
|
@ -41,7 +42,7 @@ export default defineNuxtPlugin(({ $scrollToTop }) => {
|
||||||
// TODO: find a better solution than clicking buttons...
|
// TODO: find a better solution than clicking buttons...
|
||||||
document
|
document
|
||||||
.querySelector<HTMLElement>('[aria-roledescription=status-details]')
|
.querySelector<HTMLElement>('[aria-roledescription=status-details]')
|
||||||
?.querySelector<HTMLElement>('button[aria-label=Favourite]')
|
?.querySelector<HTMLElement>(`button[aria-label=${i18n.t('action.favourite')}]`)
|
||||||
?.click()
|
?.click()
|
||||||
}
|
}
|
||||||
whenever(logicAnd(isAuthenticated, notUsingInput, keys.f), toggleFavouriteActiveStatus)
|
whenever(logicAnd(isAuthenticated, notUsingInput, keys.f), toggleFavouriteActiveStatus)
|
||||||
|
@ -50,7 +51,7 @@ export default defineNuxtPlugin(({ $scrollToTop }) => {
|
||||||
// TODO: find a better solution than clicking buttons...
|
// TODO: find a better solution than clicking buttons...
|
||||||
document
|
document
|
||||||
.querySelector<HTMLElement>('[aria-roledescription=status-details]')
|
.querySelector<HTMLElement>('[aria-roledescription=status-details]')
|
||||||
?.querySelector<HTMLElement>('button[aria-label=Boost]')
|
?.querySelector<HTMLElement>(`button[aria-label=${i18n.t('action.boost')}]`)
|
||||||
?.click()
|
?.click()
|
||||||
}
|
}
|
||||||
whenever(logicAnd(isAuthenticated, notUsingInput, keys.b), toggleBoostActiveStatus)
|
whenever(logicAnd(isAuthenticated, notUsingInput, keys.b), toggleBoostActiveStatus)
|
||||||
|
|
Loading…
Reference in a new issue