File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed
libs/remix-ui/modal-dialog/src/lib Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -26,25 +26,25 @@ export const ModalDialog = (props: ModalDialogProps) => {
2626 useEffect ( ( ) => {
2727 calledHideFunctionOnce . current = props . hide
2828 modal . current . focus ( )
29- } , [ props . hide ] )
3029
31- useEffect ( ( ) => {
32- function handleBlur ( e ) {
33- if ( ! e . currentTarget . contains ( e . relatedTarget ) ) {
34- e . stopPropagation ( )
35- if ( document . activeElement !== this ) {
36- ! window . testmode && handleHide ( )
37- if ( props . cancelFn ) props . cancelFn ( )
38- }
39- }
40- }
4130 if ( modal . current ) {
31+ modal . current . removeEventListener ( 'blur' , handleBlur )
4232 modal . current . addEventListener ( 'blur' , handleBlur )
4333 }
4434 return ( ) => {
4535 modal . current && modal . current . removeEventListener ( 'blur' , handleBlur )
4636 }
47- } , [ modal . current ] )
37+ } , [ props . hide ] )
38+
39+ function handleBlur ( e ) {
40+ if ( ! e . currentTarget . contains ( e . relatedTarget ) ) {
41+ e . stopPropagation ( )
42+ if ( document . activeElement !== this ) {
43+ ! window . testmode && handleHide ( )
44+ if ( props . cancelFn ) props . cancelFn ( )
45+ }
46+ }
47+ }
4848
4949 const modalKeyEvent = ( keyCode ) => {
5050 if ( keyCode === 27 ) {
You can’t perform that action at this time.
0 commit comments