ember-basic-dropdown
ember-basic-dropdown copied to clipboard
Touch and wheel events are missing passive flag
It is best practice to add the passive flag to every wheel, mousewheel, touchstart, and touchmove event listener that does not call preventDefault()
See: https://developers.google.com/web/tools/lighthouse/audits/passive-event-listeners
Currently Lighthouse complains at this minified line:
r&&!1===r(t,e)||(13===e.keyCode?t.actions.toggle(e):32===e.keyCode?(e.preventDefault(),t.actions.toggle(e)):27===e.keyCode&&t.actions.close(e))}}},_touchMoveH
andler:function(){this.hasMoved=!0,document.removeEventListener("touchmove",this._touchMoveHandler)},stopTextSelectionUntilMouseup:function(){document.addEven
tListener("mouseup",this._mouseupHandler,!0),document.body.classList.add("ember-basic-dropdown-text-select-disabled")},addMandatoryHandlers:function(){var e=t
his
Came here to report this. If I visit https://ember-basic-dropdown.com/ in Chrome I get [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive
in the console.
I think adding passive=true
inside the on
modifier at https://github.com/cibernox/ember-basic-dropdown/blob/2e76702d02cceab841a88d2119318d2dbbc97419/addon/templates/components/basic-dropdown-trigger.hbs#L15 will get rid of the warning.
Any updates on this? @luketheobscure could you submit PR with suggested changes?
I believe that in this case they do have to be active. Passing passive=false
would silence the warning?
It did for me - not sure why I am not seeing the same chrome warnings on doc site?