@@ -59,6 +59,7 @@ const Dialog: React.FC<IDialogPropTypes> = (props) => {
5959 const contentRef = useRef < ContentRef > ( null ) ;
6060
6161 const [ animatedVisible , setAnimatedVisible ] = React . useState ( visible ) ;
62+ const [ isFixedPos , setIsFixedPos ] = React . useState ( false ) ;
6263
6364 // ========================== Init ==========================
6465 const ariaId = useId ( ) ;
@@ -116,7 +117,7 @@ const Dialog: React.FC<IDialogPropTypes> = (props) => {
116117 const contentClickRef = useRef ( false ) ;
117118 const contentTimeoutRef = useRef < ReturnType < typeof setTimeout > > ( null ) ;
118119
119- // We need record content click incase content popup out of dialog
120+ // We need record content click in case content popup out of dialog
120121 const onContentMouseDown : React . MouseEventHandler = ( ) => {
121122 clearTimeout ( contentTimeoutRef . current ) ;
122123 contentClickRef . current = true ;
@@ -154,6 +155,12 @@ const Dialog: React.FC<IDialogPropTypes> = (props) => {
154155 if ( visible ) {
155156 setAnimatedVisible ( true ) ;
156157 saveLastOutSideActiveElementRef ( ) ;
158+
159+ // Calc the position style
160+ if ( wrapperRef . current ) {
161+ const computedWrapStyle = getComputedStyle ( wrapperRef . current ) ;
162+ setIsFixedPos ( computedWrapStyle . position === 'fixed' ) ;
163+ }
157164 } else if (
158165 animatedVisible &&
159166 contentRef . current . enableMotion ( ) &&
@@ -203,6 +210,7 @@ const Dialog: React.FC<IDialogPropTypes> = (props) => {
203210 >
204211 < Content
205212 { ...props }
213+ isFixedPos = { isFixedPos }
206214 onMouseDown = { onContentMouseDown }
207215 onMouseUp = { onContentMouseUp }
208216 ref = { contentRef }
0 commit comments