Skip to content

Commit 4f9555c

Browse files
committed
fix: passive warning #3392
1 parent 5913cf9 commit 4f9555c

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

components/vc-trigger/Trigger.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export default defineComponent({
166166
currentDocument,
167167
'touchstart',
168168
this.onDocumentClick,
169-
supportsPassive ? { passive: true } : false,
169+
supportsPassive ? { passive: false } : false,
170170
);
171171
}
172172
// close popup when trigger type contains 'onContextmenu' and document is scrolling.

components/vc-util/Dom/addEventListener.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function addEventListenerWrap(target, eventType, cb, option) {
88
supportsPassive &&
99
(eventType === 'touchstart' || eventType === 'touchmove' || eventType === 'wheel')
1010
) {
11-
opt = { passive: true };
11+
opt = { passive: false };
1212
}
1313
target.addEventListener(eventType, cb, opt);
1414
}

components/vc-virtual-list/List.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ const List = defineComponent({
268268
componentRef.value.removeEventListener(
269269
'wheel',
270270
onRawWheel,
271-
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
271+
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
272272
);
273273
componentRef.value.removeEventListener('DOMMouseScroll', onFireFoxScroll as any);
274274
componentRef.value.removeEventListener('MozMousePixelScroll', onMozMousePixelScroll as any);
@@ -281,7 +281,7 @@ const List = defineComponent({
281281
componentRef.value.addEventListener(
282282
'wheel',
283283
onRawWheel,
284-
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
284+
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
285285
);
286286
componentRef.value.addEventListener('DOMMouseScroll', onFireFoxScroll as any);
287287
componentRef.value.addEventListener('MozMousePixelScroll', onMozMousePixelScroll as any);

components/vc-virtual-list/ScrollBar.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ export default defineComponent({
6464
this.scrollbarRef.current.addEventListener(
6565
'touchstart',
6666
this.onScrollbarTouchStart,
67-
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
67+
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
6868
);
6969
this.thumbRef.current.addEventListener(
7070
'touchstart',
7171
this.onMouseDown,
72-
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
72+
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
7373
);
7474
},
7575

@@ -104,7 +104,7 @@ export default defineComponent({
104104
this.thumbRef.current.addEventListener(
105105
'touchmove',
106106
this.onMouseMove,
107-
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
107+
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
108108
);
109109
this.thumbRef.current.addEventListener('touchend', this.onMouseUp);
110110
},
@@ -116,17 +116,17 @@ export default defineComponent({
116116
this.scrollbarRef.current.removeEventListener(
117117
'touchstart',
118118
this.onScrollbarTouchStart,
119-
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
119+
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
120120
);
121121
this.thumbRef.current.removeEventListener(
122122
'touchstart',
123123
this.onMouseDown,
124-
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
124+
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
125125
);
126126
this.thumbRef.current.removeEventListener(
127127
'touchmove',
128128
this.onMouseMove,
129-
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
129+
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
130130
);
131131
this.thumbRef.current.removeEventListener('touchend', this.onMouseUp);
132132

components/vc-virtual-list/hooks/useMobileTouchMove.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function useMobileTouchMove(
2323
onTouchMove,
2424
supportsPassive
2525
? ({
26-
passive: true,
26+
passive: false,
2727
} as EventListenerOptions)
2828
: false,
2929
);
@@ -72,7 +72,7 @@ export default function useMobileTouchMove(
7272
onTouchMove,
7373
supportsPassive
7474
? ({
75-
passive: true,
75+
passive: false,
7676
} as EventListenerOptions)
7777
: false,
7878
);
@@ -86,7 +86,7 @@ export default function useMobileTouchMove(
8686
onTouchStart,
8787
supportsPassive
8888
? ({
89-
passive: true,
89+
passive: false,
9090
} as EventListenerOptions)
9191
: false,
9292
);
@@ -98,7 +98,7 @@ export default function useMobileTouchMove(
9898
onTouchStart,
9999
supportsPassive
100100
? ({
101-
passive: true,
101+
passive: false,
102102
} as EventListenerOptions)
103103
: false,
104104
);

0 commit comments

Comments
 (0)