fix: better support for onwheel events in chrome (#11808)

pull/11823/head
Dominic Gannaway 7 months ago committed by GitHub
parent 97e41dc1cb
commit c71e29c1eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: better support for onwheel events in chrome

@ -55,8 +55,8 @@ export function create_event(event_name, dom, handler, options) {
// Chrome has a bug where pointer events don't work when attached to a DOM element that has been cloned
// with cloneNode() and the DOM element is disconnected from the document. To ensure the event works, we
// defer the attachment till after it's been appended to the document. TODO: remove this once Chrome fixes
// this bug.
if (event_name.startsWith('pointer')) {
// this bug. The same applies to wheel events.
if (event_name.startsWith('pointer') || event_name === 'wheel') {
queue_micro_task(() => {
dom.addEventListener(event_name, target_handler, options);
});

Loading…
Cancel
Save