File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1- import { forwardRef , useRef , useState } from "react" ;
1+ import { forwardRef , useEffect , useRef , useState } from "react" ;
22import cn from "classnames" ;
33import { BaseDialogProps , Dialog } from "@react-md/dialog" ;
44import { bem , LabelRequiredForA11y } from "@react-md/utils" ;
@@ -117,9 +117,11 @@ export const Sheet = forwardRef<HTMLDivElement, SheetProps>(function Sheet(
117117 // when sheets are not unmounted on exit, need to set it to hidden so that
118118 // tabbing no longer focuses any of the elements inside
119119 const [ hidden , setHidden ] = useState ( ! visible && ! temporary ) ;
120- if ( hidden && visible ) {
121- setHidden ( false ) ;
122- }
120+ useEffect ( ( ) => {
121+ if ( hidden && visible ) {
122+ setHidden ( false ) ;
123+ }
124+ } , [ hidden , visible ] ) ;
123125
124126 return (
125127 < Dialog
You can’t perform that action at this time.
0 commit comments