Open goswinr opened 2 months ago
Great suggestion. How are other frameworks handling it. Love to see some inspiration for this feature.
+1
This is very important. Otherwise, do we have to use addEventListener temporarily?
@chaosprint yes, currently you have to use el.addEventListener("wheel", handler, {passive:false})
so that preventDefault() works in the handler.
Opened this PR to solve this capture/once/passive/signal
https://github.com/ryansolid/dom-expressions/pull/341
Describe the bug
Most DOM events are not passive by default, but some are ( wheel, scroll, ..) . see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#passive And it is not consistent among major Browsers. Should Solids JSX support explicit passive options for event listeners ? See how React addressed this issue: https://github.com/facebook/react/issues/6436 and the resolution: https://github.com/facebook/react/pull/19654
Steps to Reproduce the Bug or Issue
see example on SolidJS Playground and below: (update Sep 2024: on chrome the playground doesn't show the bug anymore)
Expected behavior
Like
on:*
andoncapture:*
There could be a JSX syntax to specify the passive option for events. Maybeonpassive:*
andonnotpassive: *
oronWheelNotPassive
andonScrollNotPassive