-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Ember's use of touch event listeners can be bad for scroll performance #12783
Comments
Inverting these dispatcher introduced event handlers to instead be on-demand i something we have wanted to do for ages, its just a matter of finding the time, and triaging the larger set of work. If someone is motivated, we would support the effort. Typically proposals or feature requests are to be submitted as issues or if more fleshed out RFCS to the rfc repo. This issue tracker is intended for bugs etc, and this falls into the would be nice, but totally a new thing category. This should be outlined in our CONTRIBUTING.md. Im going to close this, and instead suggest it be opened as an issue on the rfc repo. |
In general from an application perspective, it is possible to disable any listeners that you do not need/want via Obviously, this does not solve the generic case of only adding listeners when needed, but it is a useful tool for applications with specific performance needs... |
@rwjblue so I was intrigued since I am now getting a I tried changing the
But I'm still being labelled a "violator". :) Am I doing something wrong? |
@ksnyde you need to disable all events that can preventDefault on scroll, so touchstart, touchmove, mousedown, mousemove, etc |
also need to check that you don't have something besides Ember adding these. |
Thanks @krisselden. the message brings up the mousewheel event specifically , is that a red herring? |
Also I guess the bigger question (for me at least) is whether one can disable events on a component by component basis rather than at the App level. I think, will be checking soon, that if I set
|
@ksnyde you have to disable them at the app level because we are using event delegation and it would be breaking to change these events to passive. It is only a subset of events that can prevent scroll with preventDefault, and it maybe some event handling in some d3 code or plugin that is adding the listener. mousewheel and touchstart, etc are common in drag/zoom code. |
My approach to solve this problem was add and remove event listeners on
|
FWIW, in the Octane model using |
Ember indiscriminately adds touch event listeners to the root element (eg. body). This means that scrolling any page that uses ember will need to be blocked on whatever JS is running. For some sites this is fine (never run anything longer than ~50ms) but for many others it results in a terrible user experience on browsers that dispatch touch events.
I came across this when doing a performance audit of this Nasa page. The page has all sorts of performance problems on mobile, but if you remove the Ember touch event listeners (or force them to be 'passive') it scrolls beautifully.
I'm working on adding a feature to the web called passive event listeners which may make it at lot easier for you to solve this problem. I'd love any feedback you have (feel free to file issues here).
I don't know Ember at all, so it's not at all clear to me what would need to change in Ember to fully adopt such a model. If the basic idea seems sound to you, perhaps we can use this issue to discuss how Ember may be able to adopt it?
The text was updated successfully, but these errors were encountered: