File tree Expand file tree Collapse file tree 4 files changed +12
-5
lines changed Expand file tree Collapse file tree 4 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 6666 "rc-align" : " ^4.0.0" ,
6767 "rc-motion" : " ^2.0.0" ,
6868 "rc-resize-observer" : " ^1.3.1" ,
69- "rc-util" : " ^5.27.1 "
69+ "rc-util" : " ^5.29.2 "
7070 },
7171 "peerDependencies" : {
7272 "react" : " >=16.9.0" ,
Original file line number Diff line number Diff line change 1+ import { isDOM } from 'rc-util/lib/Dom/findDOMNode' ;
12import isVisible from 'rc-util/lib/Dom/isVisible' ;
23import useEvent from 'rc-util/lib/hooks/useEvent' ;
34import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect' ;
@@ -232,7 +233,7 @@ export default function useAlign(
232233 if (
233234 scaleX === 0 ||
234235 scaleY === 0 ||
235- ( target instanceof HTMLElement && ! isVisible ( target ) )
236+ ( isDOM ( target ) && ! isVisible ( target ) )
236237 ) {
237238 return ;
238239 }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import ResizeObserver from 'rc-resize-observer';
55import useEvent from 'rc-util/lib/hooks/useEvent' ;
66import useId from 'rc-util/lib/hooks/useId' ;
77import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect' ;
8+ import { isDOM } from 'rc-util/lib/Dom/findDOMNode' ;
89import * as React from 'react' ;
910import type { TriggerContextProps } from './context' ;
1011import TriggerContext from './context' ;
@@ -214,7 +215,7 @@ export function generateTrigger(
214215 const [ popupEle , setPopupEle ] = React . useState < HTMLDivElement > ( null ) ;
215216
216217 const setPopupRef = React . useCallback ( ( node : HTMLDivElement ) => {
217- if ( node instanceof HTMLElement ) {
218+ if ( isDOM ( node ) ) {
218219 setPopupEle ( node ) ;
219220 }
220221
@@ -226,7 +227,7 @@ export function generateTrigger(
226227 const [ targetEle , setTargetEle ] = React . useState < HTMLElement > ( null ) ;
227228
228229 const setTargetRef = React . useCallback ( ( node : HTMLElement ) => {
229- if ( node instanceof HTMLElement ) {
230+ if ( isDOM ( node ) ) {
230231 setTargetEle ( node ) ;
231232 }
232233 } , [ ] ) ;
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ describe('Trigger.Align', () => {
3131 get : ( ) => ( targetVisible ? document . body : null ) ,
3232 } ,
3333 } ) ;
34+ spyElementPrototypes ( SVGElement , {
35+ offsetParent : {
36+ get : ( ) => ( targetVisible ? document . body : null ) ,
37+ } ,
38+ } ) ;
3439 } ) ;
3540
3641 beforeEach ( ( ) => {
@@ -192,7 +197,7 @@ describe('Trigger.Align', () => {
192197 targetOffset : [ 903 , 1128 ] ,
193198 } }
194199 >
195- < span />
200+ < svg />
196201 </ Trigger > ,
197202 ) ;
198203
You can’t perform that action at this time.
0 commit comments