Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property to distinguish whether listener is passive or no/event is preventable #587

Open
FRSgit opened this issue Mar 9, 2018 · 2 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: events

Comments

@FRSgit
Copy link

FRSgit commented Mar 9, 2018

Linking issue from interventions WICG repo to keep continuity: WICG/interventions#63.

Summarizing:

There is no way to distinguish (from inside of the listener) whether event can be cancelable or no (or simpler - if preventDefault can be fired) - unfortunately cancelable property, which is available in the event object doesn't give any info about that (at least in scenario of passive listener).

Proposal would be to change a bit conditions under which cancelable is set to false (to cover passive listener scenario) or to add to the event object a new property (e.g. 'preventable') which will always go along with the real possiblity to stop the event.

@FRSgit
Copy link
Author

FRSgit commented May 18, 2022

There is also another solution here - to allow implementers to run preventDefault without console.error being raised at all or with possibility to silence this kind of warning message. For more context please have a look here: WICG/interventions#63 (comment)

@smaug----
Copy link
Collaborator

Internally in Gecko Event objects do have a flag whether they are being handled by a passive listener. We could expose that to JS. It would be a rather ugly API (since Event shouldn't care or know about the listener), but perhaps practical?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: events
Development

No branches or pull requests

3 participants