1- import React , { useCallback , useEffect , useState } from 'react' ;
1+ import React , { useCallback , useEffect , useRef , useState } from 'react' ;
22
33import { Button , Separator } from '@douglasneuroinformatics/libui/components' ;
44import { type Theme , useTheme , useTranslation } from '@douglasneuroinformatics/libui/hooks' ;
@@ -21,6 +21,7 @@ export const InteractiveContent = React.memo<InteractiveContentProps>(function I
2121 const { changeLanguage } = useTranslation ( ) ;
2222 const [ _ , updateTheme ] = useTheme ( ) ;
2323 const [ scale , setScale ] = useState ( 100 ) ;
24+ const iFrameRef = useRef < HTMLIFrameElement > ( null ) ;
2425
2526 const handleChangeLanguageEvent = useCallback (
2627 ( event : CustomEvent < Language > ) => {
@@ -56,8 +57,8 @@ export const InteractiveContent = React.memo<InteractiveContentProps>(function I
5657
5758 const handleToggleFullScreen = async ( ) => {
5859 if ( ! document . fullscreenElement ) {
59- await document . documentElement . requestFullscreen ( ) ;
60- } else if ( document . exitFullscreen ) {
60+ await iFrameRef . current ? .requestFullscreen ( ) ;
61+ } else {
6162 await document . exitFullscreen ( ) ;
6263 }
6364 } ;
@@ -109,6 +110,7 @@ export const InteractiveContent = React.memo<InteractiveContentProps>(function I
109110 className = "origin-top-left"
110111 data-bundle = { bundle }
111112 name = "interactive-instrument"
113+ ref = { iFrameRef }
112114 srcDoc = { `<script type="module">${ bootstrapScript } </script>` }
113115 style = { { height : dimensions , scale : `${ scale } %` , width : dimensions } }
114116 title = "Open Data Capture - Interactive Instrument"
0 commit comments