Skip to content

Commit 85bcdfb

Browse files
yel-haddclaude
andcommitted
STAR-71: close search drawer when a result is clicked
The search drawer was only torn down as a side effect of a full page reload. When a clicked result resolves to the page the user is already on (same pathname, only the #hash differs), window.location.href does not reload the page, so the drawer stayed open as an overlay while the content silently scrolled behind it — making the result look unclickable. DrawerSearchResult now emits `closeDrawer` on click; Drawer forwards it through the existing event chain to HeaderLayoutSearch.closeDrawer, so the drawer closes on every navigation, reload or hash-only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 42ad374 commit 85bcdfb

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

docs/.vuepress/theme/drawer/Drawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="drawer-main__breadcrumb">
1818
<!-- Optional breadcrumb can stay here -->
1919
</div>
20-
<DrawerSearchResult :modelValue="modelValue" :data="drawerArticleResult"/>
20+
<DrawerSearchResult :modelValue="modelValue" :data="drawerArticleResult" @closeDrawer="onCloseDrawer"/>
2121
</div>
2222
</div>
2323
<Footer v-if="isOpenDrawer && isMobileWidth" class="drawer-footer__mobile"/>

docs/.vuepress/theme/drawer/DrawerSearchResult.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ const props = defineProps({
6161
const { MAX_VISIBLE_RESULT } = inject("themeConfig");
6262
const isShowAllResult = ref(false);
6363
64+
const emit = defineEmits(["closeDrawer"]);
65+
6466
const gotTo = (url) => {
67+
// Always close the search drawer on click. When the target resolves to the
68+
// page we are already on (same pathname, only the #hash differs) the browser
69+
// does NOT reload, so the drawer would otherwise stay open over the page and
70+
// the result would look unclickable (STAR-71).
71+
emit("closeDrawer");
6572
const parsedCurrentUrl = new URL(window.location.href);
6673
if (parsedCurrentUrl.pathname + parsedCurrentUrl.hash === url) {
6774
window.location.reload();

0 commit comments

Comments
 (0)