Skip to content

Commit 1fe598f

Browse files
authored
fix: some keyboard shortcuts not working in non-english (#2324)
1 parent e9f274f commit 1fe598f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugins/magic-keys.client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useMagicSequence } from '~/composables/magickeys'
44
export default defineNuxtPlugin(({ $scrollToTop }) => {
55
const keys = useMagicKeys()
66
const router = useRouter()
7+
const i18n = useNuxtApp().$i18n
78

89
// disable shortcuts when focused on inputs (https://vueuse.org/core/usemagickeys/#conditionally-disable)
910
const activeElement = useActiveElement()
@@ -41,7 +42,7 @@ export default defineNuxtPlugin(({ $scrollToTop }) => {
4142
// TODO: find a better solution than clicking buttons...
4243
document
4344
.querySelector<HTMLElement>('[aria-roledescription=status-details]')
44-
?.querySelector<HTMLElement>('button[aria-label=Favourite]')
45+
?.querySelector<HTMLElement>(`button[aria-label=${i18n.t('action.favourite')}]`)
4546
?.click()
4647
}
4748
whenever(logicAnd(isAuthenticated, notUsingInput, keys.f), toggleFavouriteActiveStatus)
@@ -50,7 +51,7 @@ export default defineNuxtPlugin(({ $scrollToTop }) => {
5051
// TODO: find a better solution than clicking buttons...
5152
document
5253
.querySelector<HTMLElement>('[aria-roledescription=status-details]')
53-
?.querySelector<HTMLElement>('button[aria-label=Boost]')
54+
?.querySelector<HTMLElement>(`button[aria-label=${i18n.t('action.boost')}]`)
5455
?.click()
5556
}
5657
whenever(logicAnd(isAuthenticated, notUsingInput, keys.b), toggleBoostActiveStatus)

0 commit comments

Comments
 (0)