Angular.js: Consider adding support for passive event listeners

Created on 7 Apr 2017  ·  4Comments  ·  Source: angular/angular.js

I'm submitting a ...

  • [x] bug report
  • [ ] feature request
  • [ ] other (Please do not submit support requests here (see above))

Current behavior:
Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive.

Expected / new behavior:
Passive event listeners are a new feature in the DOM spec that enable developers to opt-in to better scroll performance by eliminating the need for scrolling to block on touch and wheel event listeners. Developers can annotate touch and wheel listeners with {passive: true} to indicate that they will never invoke preventDefault. This feature shipped in Chrome 51, Firefox 49 and landed in WebKit. For full official explanation read more here.

Minimal reproduction of the problem with instructions:

Angular version: 1.6.4

Browser: Chrome 59

Anything else:
http://stackoverflow.com/questions/39152877/consider-marking-event-handler-as-passive-to-make-the-page-more-responsive

misc core moderate won't fix inconvenient feature

Most helpful comment

Hi, thanks for the suggestion. This behavior is in the spec (https://dom.spec.whatwg.org/#dictdef-eventlisteneroptions), but support is lacking in IE / Edge and Safari. I assume we could make an exception here, since the options object is ignored by browsers that don't support it, is that correct?

All 4 comments

Hi, thanks for the suggestion. This behavior is in the spec (https://dom.spec.whatwg.org/#dictdef-eventlisteneroptions), but support is lacking in IE / Edge and Safari. I assume we could make an exception here, since the options object is ignored by browsers that don't support it, is that correct?

You are right!

The object might be ignored, but it will resolve to a truthy value for browsers who do not support the options object, which sets the useCapture to true.

Based on this comment https://github.com/angular/angular.js/pull/16026#issuecomment-305763416, this is a wontfix for the forseeable future

Was this page helpful?
0 / 5 - 0 ratings