diff --git a/front/src/components/auth/LoginForm.vue b/front/src/components/auth/LoginForm.vue index 3a2dd1ab4..e791141c3 100644 --- a/front/src/components/auth/LoginForm.vue +++ b/front/src/components/auth/LoginForm.vue @@ -2,7 +2,7 @@ import type { BackendError } from '~/types' import type { RouteLocationRaw } from 'vue-router' -import { ref, reactive, computed, onMounted } from 'vue' +import { ref, reactive, computed, onMounted, nextTick } from 'vue' import { useGettext } from 'vue3-gettext' import { useStore } from '~/store' @@ -34,7 +34,10 @@ const labels = computed(() => ({ })) const username = ref() -onMounted(() => username.value.focus()) +onMounted(async () => { + await nextTick() + username.value?.focus() +}) const isLoading = ref(false) const errors = ref([] as string[]) diff --git a/front/src/composables/audio/usePlayOptions.ts b/front/src/composables/audio/usePlayOptions.ts index b220d912f..33ae3d4d5 100644 --- a/front/src/composables/audio/usePlayOptions.ts +++ b/front/src/composables/audio/usePlayOptions.ts @@ -38,9 +38,9 @@ export default (props: PlayOptionsProps) => { return props.track.uploads?.length > 0 } else if (props.artist) { return props.artist.tracks_count > 0 - || props.artist?.albums.some((album) => album.is_playable === true) + || props.artist?.albums?.some((album) => album.is_playable === true) } else if (props.tracks) { - return props.tracks.some((track) => (track.uploads?.length ?? 0) > 0) + return props.tracks?.some((track) => (track.uploads?.length ?? 0) > 0) } return false diff --git a/front/src/composables/onKeyboardShortcut.ts b/front/src/composables/onKeyboardShortcut.ts index 49667562c..a1bf44a7a 100644 --- a/front/src/composables/onKeyboardShortcut.ts +++ b/front/src/composables/onKeyboardShortcut.ts @@ -16,7 +16,7 @@ const bodyIsActive = computed(() => activeElement.value === document.body) const current = new Set() useEventListener(window, 'keydown', (event) => { - if (!bodyIsActive.value) return + if (!bodyIsActive.value && !event.key) return current.add(event.key.toLowerCase()) const currentArray = [...current] @@ -29,7 +29,9 @@ useEventListener(window, 'keydown', (event) => { }) useEventListener(window, 'keyup', (event) => { - current.delete(event.key.toLowerCase()) + if (!event.key) { + current.delete(event.key.toLowerCase()) + } }) export default (key: KeyFilter, handler: () => unknown, prevent = false) => {