From ed3edcdfc44bbfc2a74b05565ab59ce0af083f8e Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Wed, 3 Sep 2025 09:17:42 -0400 Subject: [PATCH] Replace activeElement with type exact useActiveElement --- .../common/Navigation/CollectionsDrawer.vue | 12 ++++-------- .../components/common/Navigation/MainAppBar.vue | 12 +++++++++--- .../common/Navigation/PlatformsDrawer.vue | 14 ++++++++------ .../common/Navigation/SettingsDrawer.vue | 9 +++++---- .../src/console/components/ScreenshotLightbox.vue | 5 ++++- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/frontend/src/components/common/Navigation/CollectionsDrawer.vue b/frontend/src/components/common/Navigation/CollectionsDrawer.vue index 15e36468f..fa6546933 100644 --- a/frontend/src/components/common/Navigation/CollectionsDrawer.vue +++ b/frontend/src/components/common/Navigation/CollectionsDrawer.vue @@ -5,7 +5,7 @@ import CollectionListItem from "@/components/common/Collection/ListItem.vue"; import storeCollections from "@/stores/collections"; import storeNavigation from "@/stores/navigation"; import type { Events } from "@/types/emitter"; -import { useLocalStorage } from "@vueuse/core"; +import { useActiveElement, useLocalStorage } from "@vueuse/core"; import type { Emitter } from "mitt"; import { storeToRefs } from "pinia"; import { inject, onBeforeUnmount, onMounted, ref, watch, computed } from "vue"; @@ -15,6 +15,7 @@ import { useDisplay } from "vuetify"; const { t } = useI18n(); const navigationStore = storeNavigation(); const { mdAndUp, smAndDown } = useDisplay(); +const activeElement = useActiveElement(); const collectionsStore = storeCollections(); const { filteredCollections, @@ -41,15 +42,11 @@ function clear() { } // Ref to store the element that triggered the drawer -const triggerElement = ref(null); -// Watch for changes in the navigation drawer state -const textFieldRef = ref(); +const triggerElement = ref(undefined); watch(activeCollectionsDrawer, (isOpen) => { if (isOpen) { // Store the currently focused element before opening the drawer - triggerElement.value = document.activeElement as HTMLElement; - // Focus the text field when the drawer is opened - // textFieldRef.value?.focus(); + triggerElement.value = activeElement.value; } }); @@ -110,7 +107,6 @@ function onClose() { >