@@ -135,6 +135,11 @@ function getFileTabTitle(filePath: string): string {
135135const ReviewApp : React . FC < { __embedded ?: boolean ; headerLeft ?: React . ReactNode } > = ( { __embedded, headerLeft } ) => {
136136 const fetch = useSessionFetch ( ) ;
137137 const { resolvedMode } = useTheme ( ) ;
138+ const rootRef = useRef < HTMLDivElement > ( null ) ;
139+ const isVisible = useCallback ( ( ) => {
140+ if ( ! rootRef . current ) return true ;
141+ return getComputedStyle ( rootRef . current ) . visibility !== 'hidden' ;
142+ } , [ ] ) ;
138143 const [ diffData , setDiffData ] = useState < DiffData | null > ( null ) ;
139144 const [ files , setFiles ] = useState < DiffFile [ ] > ( [ ] ) ;
140145 const [ activeFileIndex , setActiveFileIndex ] = useState ( 0 ) ;
@@ -635,6 +640,7 @@ const ReviewApp: React.FC<{ __embedded?: boolean; headerLeft?: React.ReactNode }
635640 useEffect ( ( ) => {
636641 if ( ! import . meta. env . DEV ) return ;
637642 const handler = ( e : KeyboardEvent ) => {
643+ if ( ! isVisible ( ) ) return ;
638644 if ( ( e . metaKey || e . ctrlKey ) && e . shiftKey && ( e . key === 'T' || e . key === 't' ) ) {
639645 e . preventDefault ( ) ;
640646 setTourDialogJobId ( prev => ( prev === DEMO_TOUR_ID ? null : DEMO_TOUR_ID ) ) ;
@@ -701,6 +707,7 @@ const ReviewApp: React.FC<{ __embedded?: boolean; headerLeft?: React.ReactNode }
701707 // Global keyboard shortcuts
702708 useEffect ( ( ) => {
703709 const handleKeyDown = ( e : KeyboardEvent ) => {
710+ if ( ! isVisible ( ) ) return ;
704711 // Cmd/Ctrl+F to focus file search when diff files are available.
705712 if ( ( e . metaKey || e . ctrlKey ) && e . key . toLowerCase ( ) === 'f' && ! isTypingTarget ( e . target ) ) {
706713 if ( hasSearchableFiles ) {
@@ -1074,6 +1081,7 @@ const ReviewApp: React.FC<{ __embedded?: boolean; headerLeft?: React.ReactNode }
10741081
10751082 useEffect ( ( ) => {
10761083 const handler = ( e : KeyboardEvent ) => {
1084+ if ( ! isVisible ( ) ) return ;
10771085 if ( e . metaKey || e . ctrlKey || e . shiftKey || isTypingTarget ( e . target ) ) return ;
10781086 if ( ! isDiffPanelActive ) return ;
10791087 const filePath = files [ activeFileIndex ] ?. path ;
@@ -1676,6 +1684,7 @@ const ReviewApp: React.FC<{ __embedded?: boolean; headerLeft?: React.ReactNode }
16761684 const DOUBLE_TAP_WINDOW = 300 ;
16771685
16781686 const handleKeyDown = ( e : KeyboardEvent ) => {
1687+ if ( ! isVisible ( ) ) return ;
16791688 if ( e . key !== 'Alt' || e . repeat ) return ;
16801689 const tag = ( e . target as HTMLElement ) ?. tagName ;
16811690 if ( tag === 'INPUT' || tag === 'TEXTAREA' ) return ;
@@ -1708,6 +1717,7 @@ const ReviewApp: React.FC<{ __embedded?: boolean; headerLeft?: React.ReactNode }
17081717 // Cmd/Ctrl+Enter keyboard shortcut to approve or send feedback
17091718 useEffect ( ( ) => {
17101719 const handleKeyDown = ( e : KeyboardEvent ) => {
1720+ if ( ! isVisible ( ) ) return ;
17111721 if ( e . key !== 'Enter' || ! ( e . metaKey || e . ctrlKey ) ) return ;
17121722
17131723 // If the platform post dialog is open, Cmd+Enter submits it
@@ -1772,7 +1782,7 @@ const ReviewApp: React.FC<{ __embedded?: boolean; headerLeft?: React.ReactNode }
17721782 < ReviewStateProvider value = { reviewStateValue } >
17731783 < JobLogsProvider value = { jobLogsValue } >
17741784 { isSwitchingPRScope && < PRSwitchOverlay /> }
1775- < div className = { `${ __embedded ? 'h-full' : 'h-screen' } flex flex-col bg-background overflow-hidden` } >
1785+ < div ref = { rootRef } className = { `${ __embedded ? 'h-full' : 'h-screen' } flex flex-col bg-background overflow-hidden` } >
17761786 { /* Header */ }
17771787 < header className = "py-1 flex items-center justify-between px-2 md:px-4 border-b border-border/50 bg-card/50 backdrop-blur-xl z-50" >
17781788 < div className = { `min-w-0 flex items-center gap-2 md:gap-3 ${ headerLeft ? '' : '-ml-1.5 md:-ml-3' } ` } >
0 commit comments