@@ -81,6 +81,7 @@ import { AISparkleIcon } from "~/assets/icons/AISparkleIcon";
8181import { ShortcutKey } from "../primitives/ShortcutKey" ;
8282import { useFeatures } from "~/hooks/useFeatures" ;
8383import { useKapa } from "~/root" ;
84+ import { useShortcuts } from "~/components/primitives/ShortcutsProvider" ;
8485
8586type SideMenuUser = Pick < User , "email" | "admin" > & { isImpersonating : boolean } ;
8687export type SideMenuProject = Pick <
@@ -550,6 +551,7 @@ function HelpAndAI() {
550551 const [ isKapaOpen , setIsKapaOpen ] = useState ( false ) ;
551552 const features = useFeatures ( ) ;
552553 const kapa = useKapa ( ) ;
554+ const { disableShortcuts, enableShortcuts } = useShortcuts ( ) ;
553555
554556 useEffect ( ( ) => {
555557 if ( ! features . isManagedCloud || ! kapa ?. websiteId ) return ;
@@ -559,13 +561,19 @@ function HelpAndAI() {
559561 // Define the handler function
560562 const handleModalClose = ( ) => {
561563 setIsKapaOpen ( false ) ;
564+ enableShortcuts ( ) ;
562565 } ;
563566
564567 const kapaInterval = setInterval ( ( ) => {
565568 if ( typeof window . Kapa === "function" ) {
566569 clearInterval ( kapaInterval ) ;
567570 window . Kapa ( "render" ) ;
568571 window . Kapa ( "onModalClose" , handleModalClose ) ;
572+ // Register onModalOpen handler
573+ window . Kapa ( "onModalOpen" , ( ) => {
574+ setIsKapaOpen ( true ) ;
575+ disableShortcuts ( ) ;
576+ } ) ;
569577 }
570578 } , 100 ) ;
571579
@@ -576,7 +584,7 @@ function HelpAndAI() {
576584 window . Kapa ( "unmount" ) ;
577585 }
578586 } ;
579- } , [ features . isManagedCloud , kapa ?. websiteId ] ) ;
587+ } , [ features . isManagedCloud , kapa ?. websiteId , disableShortcuts , enableShortcuts ] ) ;
580588
581589 return (
582590 < >
@@ -595,6 +603,7 @@ function HelpAndAI() {
595603 if ( typeof window . Kapa === "function" ) {
596604 window . Kapa ( "open" ) ;
597605 setIsKapaOpen ( true ) ;
606+ disableShortcuts ( ) ;
598607 }
599608 } }
600609 >
0 commit comments