Skip to content

Commit

Permalink
fix: some keyboard shortcuts not working in non-english (#2324)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sma11X authored Oct 13, 2023
1 parent e9f274f commit 1fe598f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/magic-keys.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useMagicSequence } from '~/composables/magickeys'
export default defineNuxtPlugin(({ $scrollToTop }) => {
const keys = useMagicKeys()
const router = useRouter()
const i18n = useNuxtApp().$i18n

// disable shortcuts when focused on inputs (https://vueuse.org/core/usemagickeys/#conditionally-disable)
const activeElement = useActiveElement()
Expand Down Expand Up @@ -41,7 +42,7 @@ export default defineNuxtPlugin(({ $scrollToTop }) => {
// TODO: find a better solution than clicking buttons...
document
.querySelector<HTMLElement>('[aria-roledescription=status-details]')
?.querySelector<HTMLElement>('button[aria-label=Favourite]')
?.querySelector<HTMLElement>(`button[aria-label=${i18n.t('action.favourite')}]`)
?.click()
}
whenever(logicAnd(isAuthenticated, notUsingInput, keys.f), toggleFavouriteActiveStatus)
Expand All @@ -50,7 +51,7 @@ export default defineNuxtPlugin(({ $scrollToTop }) => {
// TODO: find a better solution than clicking buttons...
document
.querySelector<HTMLElement>('[aria-roledescription=status-details]')
?.querySelector<HTMLElement>('button[aria-label=Boost]')
?.querySelector<HTMLElement>(`button[aria-label=${i18n.t('action.boost')}]`)
?.click()
}
whenever(logicAnd(isAuthenticated, notUsingInput, keys.b), toggleBoostActiveStatus)
Expand Down

0 comments on commit 1fe598f

Please sign in to comment.