Version: 2.8.0
On touch devices, Container's debouncePause and mouseUp call e.preventDefault() unconditionally. React binds touchstart/touchend as passive listeners, so the event is non-cancelable and the browser logs on every tap/hold:
Unable to preventDefault inside passive event listener invocation.
Repro: render <Stories>, open on a touch device (or DevTools touch emulation), tap or press-and-hold — the warning fires each time.
Cause: preventDefault() is called without checking e.cancelable.
Suggested fix (src/components/Container.tsx):
const debouncePause = (e: React.MouseEvent | React.TouchEvent) => {
- e.preventDefault();
+ if (e.cancelable) e.preventDefault();
mousedownId.current = setTimeout(() => {
toggleState('pause');
}, 200);
};
const mouseUp = (type: string) => (e: React.MouseEvent | React.TouchEvent) => {
- e.preventDefault();
+ if (e.cancelable) e.preventDefault();
mousedownId.current && clearTimeout(mousedownId.current);
// …unchanged
};
Functionality is unchanged (pause/nav still runs via the existing setTimeout); only the no-op call and the console warning go away.
Version: 2.8.0
On touch devices,
Container'sdebouncePauseandmouseUpcalle.preventDefault()unconditionally. React bindstouchstart/touchendas passive listeners, so the event is non-cancelable and the browser logs on every tap/hold:Repro: render
<Stories>, open on a touch device (or DevTools touch emulation), tap or press-and-hold — the warning fires each time.Cause:
preventDefault()is called without checkinge.cancelable.Suggested fix (
src/components/Container.tsx):const debouncePause = (e: React.MouseEvent | React.TouchEvent) => { - e.preventDefault(); + if (e.cancelable) e.preventDefault(); mousedownId.current = setTimeout(() => { toggleState('pause'); }, 200); }; const mouseUp = (type: string) => (e: React.MouseEvent | React.TouchEvent) => { - e.preventDefault(); + if (e.cancelable) e.preventDefault(); mousedownId.current && clearTimeout(mousedownId.current); // …unchanged };Functionality is unchanged (pause/nav still runs via the existing
setTimeout); only the no-op call and the console warning go away.