From 804f04911176f016bd691c7dd2b3efa343151f0a Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 2 Mar 2025 14:46:05 -0500 Subject: [PATCH] Fix search bar behaviour (step 8) --- pvc-vue/src/components/general/VMSearchBar.vue | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pvc-vue/src/components/general/VMSearchBar.vue b/pvc-vue/src/components/general/VMSearchBar.vue index 221dec2..507d5dd 100644 --- a/pvc-vue/src/components/general/VMSearchBar.vue +++ b/pvc-vue/src/components/general/VMSearchBar.vue @@ -262,6 +262,20 @@ const handleSearchClick = () => { const toggleList = () => { // If the list is already open, toggle filtering instead of closing if (props.showList) { + // If we're in list mode (not filtering) and the button is clicked, close the drawer + if (!isFilterActive.value) { + // Save the current search text before closing + if (props.modelValue) { + searchText.value = props.modelValue; + // Save to localStorage + localStorage.setItem('vmSearchText', props.modelValue); + } + + // Close the drawer + emit('toggle-list'); + return; + } + // Toggle filtering mode isFilterActive.value = !isFilterActive.value;