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

Add support for passive event listeners #4724

Closed
wants to merge 3 commits into from

Conversation

dfreedm
Copy link
Member

@dfreedm dfreedm commented Jul 5, 2017

Provide a way for elements to have passive gesture listeners with
this._passiveGestures = true

Fixes #4667
Fixes #3787
Fixes #3604

TODO:

  • add tests

Provide a way for elements to have passive gesture listeners with
this._passiveGestures = true;

Fixes #4667
Fixes #3787
Fixes #3604
Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried to write tests for this PR, but sadly unsuccessful. Yes the patch works, but there is no programmatic way of detecting if it did.

  1. event.preventDefault() does not throw an error nor does it call console.error(). Instead, it shows the error in dev-tools but happily continues executing
  2. On the internet I also found that event.cancellable should signal if you can cancel the event or not, however that is not working either. Even if you initially set cancellable: true for the event, passive: true does not alter this value.

The patch seems to be working, so /shrug

@dtapuska
Copy link

dtapuska commented Sep 6, 2017

@TimvdLippe Tim you should be able to test this via calling preventDefault() and checking whether defaultPrevented was true on the Event.

@dfreedm
Copy link
Member Author

dfreedm commented Sep 7, 2017

After some thought, I don't think this approach is really workable. It requires individual elements to agree on setting passive, but at an application level, it may not be possible to know which element set the listeners that may affect scrolling.

Instead #4829 has a more limited version that is 100% app controlled.

@dfreedm dfreedm closed this Sep 7, 2017
@dfreedm dfreedm deleted the optional-passive-events branch September 13, 2017 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants