Alpine: x-on support for passive event listeners

Created on 6 Jun 2020  路  8Comments  路  Source: alpinejs/alpine

I would love to see support for passive event listeners. I imagine it working like:

<div @mousedown.passive="interactive = true">

It looks like it should be pretty easy to implement as x-on is already creating an event listener for the element.
https://github.com/alpinejs/alpine/blob/5181242588436f58c3ea19cd0e45d6dcbe29f853/src/directives/on.js#L22

_Originally posted by @alex-page in https://github.com/alpinejs/alpine/discussions/557_

enhancement

Most helpful comment

@ryangjchandler did you end up working on this? I might pick this up at some point next week otherwise 馃槃

Yeah, wrapping up the PR. Will submit tomorrow 馃馃徏

All 8 comments

Bear in mind the following:

Otherwise all the code changes should be localised to the on.js file you've mentioned.

Google Lighthouse dings my site for not using a passive scroll listener and I don鈥檛 support IE11, so I would appreciate this.

Will look at a PR for this one this weekend.

@ryangjchandler did you end up working on this? I might pick this up at some point next week otherwise 馃槃

@ryangjchandler did you end up working on this? I might pick this up at some point next week otherwise 馃槃

Yeah, wrapping up the PR. Will submit tomorrow 馃馃徏

@ryangjchandler just so we aren't blocking anyone are you able to put up a draft PR?

@alex-page didn't get around to doing this - @HugoDF did you wanna have a crack?

Sure thing

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Calinou picture Calinou  路  4Comments

piotrpog picture piotrpog  路  3Comments

aolko picture aolko  路  5Comments

bep picture bep  路  4Comments

hkan picture hkan  路  3Comments