@@ -211,13 +211,22 @@ export default function Layout(props: ParentProps) {
211211
212212 onMount ( ( ) => {
213213 const stop = ( ) => setState ( "sizing" , false )
214+ const blur = ( ) => reset ( )
215+ const hide = ( ) => {
216+ if ( document . visibilityState !== "hidden" ) return
217+ reset ( )
218+ }
214219 window . addEventListener ( "pointerup" , stop )
215220 window . addEventListener ( "pointercancel" , stop )
216221 window . addEventListener ( "blur" , stop )
222+ window . addEventListener ( "blur" , blur )
223+ document . addEventListener ( "visibilitychange" , hide )
217224 onCleanup ( ( ) => {
218225 window . removeEventListener ( "pointerup" , stop )
219226 window . removeEventListener ( "pointercancel" , stop )
220227 window . removeEventListener ( "blur" , stop )
228+ window . removeEventListener ( "blur" , blur )
229+ document . removeEventListener ( "visibilitychange" , hide )
221230 } )
222231 } )
223232
@@ -237,6 +246,12 @@ export default function Layout(props: ParentProps) {
237246 navLeave . current = undefined
238247 }
239248
249+ const reset = ( ) => {
250+ disarm ( )
251+ setState ( "hoverSession" , undefined )
252+ setHoverProject ( undefined )
253+ }
254+
240255 const arm = ( ) => {
241256 if ( layout . sidebar . opened ( ) ) return
242257 if ( state . hoverProject === undefined ) return
@@ -305,8 +320,7 @@ export default function Layout(props: ParentProps) {
305320
306321 const clearSidebarHoverState = ( ) => {
307322 if ( layout . sidebar . opened ( ) ) return
308- setState ( "hoverSession" , undefined )
309- setHoverProject ( undefined )
323+ reset ( )
310324 }
311325
312326 const navigateWithSidebarReset = ( href : string ) => {
0 commit comments