Skip to content

Commit

Permalink
fix: ensure onwheel is passive by default (#12837)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm authored Aug 14, 2024
1 parent dc787be commit b0f693b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-turkeys-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: ensure onwheel is passive by default
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @import { Expression } from 'estree' */
/** @import { Attribute, ExpressionMetadata, ExpressionTag, SvelteNode } from '#compiler' */
/** @import { ComponentContext } from '../../types' */
import { is_capture_event } from '../../../../../../utils.js';
import { is_capture_event, is_passive_event } from '../../../../../../utils.js';
import { dev, locator } from '../../../../../state.js';
import * as b from '../../../../../utils/builders.js';

Expand Down Expand Up @@ -63,7 +63,13 @@ export function visit_event_attribute(node, context) {
);
} else {
const statement = b.stmt(
build_event(event_name, context.state.node, handler, capture, undefined)
build_event(
event_name,
context.state.node,
handler,
capture,
is_passive_event(event_name) ? true : undefined
)
);

const type = /** @type {SvelteNode} */ (context.path.at(-1)).type;
Expand Down

0 comments on commit b0f693b

Please sign in to comment.