11<template >
22 <div >
3- <div class =" drawer" :class =" {'is-open': isOpenDrawer}" >
3+ <div class =" drawer" :class =" {'is-open': isOpenDrawer, 'drawer--animated': animationsReady }" >
44 <div class =" drawer-header" >
55 <div class =" drawer-header__wrapper" >
66 <h2 class =" drawer-header__paragraph" >How can we help you?</h2 >
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"/>
3030<script setup>
3131import { withBase } from " @vuepress/client" ;
3232import Footer from " ../footer/Footer.vue" ;
33- import { computed , ref , watch } from " vue" ;
33+ import { computed , onMounted , ref , watch } from " vue" ;
3434import DrawerSearchResult from " ./DrawerSearchResult.vue" ;
3535
3636const props = defineProps ({
@@ -66,6 +66,16 @@ const onCloseDrawer = () => {
6666 emit (' closeDrawer' );
6767}
6868
69+ // The drawer starts hidden (translateY(-100%)). Enabling the slide transition
70+ // only after the first paint prevents the close animation from flashing on
71+ // initial page load — it then fires only on genuine open/close toggles.
72+ const animationsReady = ref (false );
73+ onMounted (() => {
74+ requestAnimationFrame (() => requestAnimationFrame (() => {
75+ animationsReady .value = true ;
76+ }));
77+ });
78+
6979watch (() => props .isOpenDrawer , () => {
7080 document .body .classList .toggle (' disable-scroll' , props .isOpenDrawer );
7181});
@@ -89,7 +99,12 @@ watch(() => props.isOpenDrawer, () => {
8999 background : $drawerHeaderBgColor
90100 opacity : 0 ;
91101 transform : translateY (- 100% );
92- transition : 0.4s ease ;
102+
103+ // Transition is intentionally NOT set here so the initial hidden state is
104+ // applied instantly (no flash on first load). It is enabled via
105+ // .drawer--animated once the component has mounted.
106+ & .drawer--animated
107+ transition : 0.4s ease
93108
94109 & -header
95110 padding 1.25rem $layout-horizontal-padding
0 commit comments