@@ -346,6 +346,11 @@ function useQueuedNavigate(
346346 return enqueueNavigation ;
347347}
348348
349+ const flowNavigation = ( ) => {
350+ // @ts -ignore
351+ window . Vaadin . Flow . navigation = true ;
352+ } ;
353+
349354function Flow ( ) {
350355 const ref = useRef < HTMLOutputElement > ( null ) ;
351356 const navigate = useNavigate ( ) ;
@@ -403,6 +408,8 @@ function Flow() {
403408 // When navigation is triggered by click on a link, fromAnchor is set to true
404409 // in order to get a server round-trip even when navigating to the same URL again
405410 fromAnchor . current = true ;
411+ // @ts -ignore
412+ window . Vaadin . Flow . navigation = true ;
406413 navigate ( path ) ;
407414 // Dispatch close event for overlay drawer on click navigation.
408415 window . dispatchEvent ( new CustomEvent ( 'close-overlay-drawer' ) ) ;
@@ -463,13 +470,17 @@ function Flow() {
463470 } , [ vaadinRouterGoEventHandler , vaadinNavigateEventHandler ] ) ;
464471
465472 useEffect ( ( ) => {
473+ // @ts -ignore
474+ window . addEventListener ( "popstate" , flowNavigation ) ;
466475 window . addEventListener ( 'click' , navigateEventHandler ) ;
467476 flowReact . active = true ;
468477
469478 return ( ) => {
470479 containerRef . current ?. parentNode ?. removeChild ( containerRef . current ) ;
471480 containerRef . current ?. removeEventListener ( 'flow-portal-add' , addPortalEventHandler as EventListener ) ;
472481 containerRef . current = undefined ;
482+ // @ts -ignore
483+ window . removeEventListener ( "popstate" , flowNavigation ) ;
473484 window . removeEventListener ( 'click' , navigateEventHandler ) ;
474485 flowReact . active = false ;
475486 } ;
0 commit comments