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 66
66
"rc-align" : " ^4.0.0" ,
67
67
"rc-motion" : " ^2.0.0" ,
68
68
"rc-resize-observer" : " ^1.3.1" ,
69
- "rc-util" : " ^5.27.1 "
69
+ "rc-util" : " ^5.29.2 "
70
70
},
71
71
"peerDependencies" : {
72
72
"react" : " >=16.9.0" ,
Original file line number Diff line number Diff line change
1
+ import { isDOM } from 'rc-util/lib/Dom/findDOMNode' ;
1
2
import isVisible from 'rc-util/lib/Dom/isVisible' ;
2
3
import useEvent from 'rc-util/lib/hooks/useEvent' ;
3
4
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect' ;
@@ -232,7 +233,7 @@ export default function useAlign(
232
233
if (
233
234
scaleX === 0 ||
234
235
scaleY === 0 ||
235
- ( target instanceof HTMLElement && ! isVisible ( target ) )
236
+ ( isDOM ( target ) && ! isVisible ( target ) )
236
237
) {
237
238
return ;
238
239
}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import ResizeObserver from 'rc-resize-observer';
5
5
import useEvent from 'rc-util/lib/hooks/useEvent' ;
6
6
import useId from 'rc-util/lib/hooks/useId' ;
7
7
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect' ;
8
+ import { isDOM } from 'rc-util/lib/Dom/findDOMNode' ;
8
9
import * as React from 'react' ;
9
10
import type { TriggerContextProps } from './context' ;
10
11
import TriggerContext from './context' ;
@@ -214,7 +215,7 @@ export function generateTrigger(
214
215
const [ popupEle , setPopupEle ] = React . useState < HTMLDivElement > ( null ) ;
215
216
216
217
const setPopupRef = React . useCallback ( ( node : HTMLDivElement ) => {
217
- if ( node instanceof HTMLElement ) {
218
+ if ( isDOM ( node ) ) {
218
219
setPopupEle ( node ) ;
219
220
}
220
221
@@ -226,7 +227,7 @@ export function generateTrigger(
226
227
const [ targetEle , setTargetEle ] = React . useState < HTMLElement > ( null ) ;
227
228
228
229
const setTargetRef = React . useCallback ( ( node : HTMLElement ) => {
229
- if ( node instanceof HTMLElement ) {
230
+ if ( isDOM ( node ) ) {
230
231
setTargetEle ( node ) ;
231
232
}
232
233
} , [ ] ) ;
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ describe('Trigger.Align', () => {
31
31
get : ( ) => ( targetVisible ? document . body : null ) ,
32
32
} ,
33
33
} ) ;
34
+ spyElementPrototypes ( SVGElement , {
35
+ offsetParent : {
36
+ get : ( ) => ( targetVisible ? document . body : null ) ,
37
+ } ,
38
+ } ) ;
34
39
} ) ;
35
40
36
41
beforeEach ( ( ) => {
@@ -192,7 +197,7 @@ describe('Trigger.Align', () => {
192
197
targetOffset : [ 903 , 1128 ] ,
193
198
} }
194
199
>
195
- < span />
200
+ < svg />
196
201
</ Trigger > ,
197
202
) ;
198
203
You can’t perform that action at this time.
0 commit comments