Don
November 26, 2021, 8:57am
1
Hello,
With the latest update 1b5f26e0ab I used all day and the problem appear yesterday night. So I think the issue in one of the last few commits.
It seems to happens when I touch and start scrolling. The scrolling is not start immediately.
The issue seems to only on Android on both view (mobile and desktop) and the PWA and browser too.
It affect on the whole site where scrolling available.
My device:
Android 10
Chrome 96.0.4664.45
Thanks
3 Likes
david
(David Taylor)
November 26, 2021, 12:55pm
2
This is very interesting, thanks for reporting! As far as Iām aware, the only recent commit which affects scrolling would be:
committed 12:07PM - 25 Nov 21 UTC
- Remove JQuery
- Remove legacy `document.webkitHidden` support. None of our cuā¦ rrently supported browsers need this
- Use `passive` event listeners. These allows the browser to process the events first, before passing control to us
- Add a new `unseenTime` parameter. This allows consumers to request a delay before being notified about the browser going into the background
- Add a method for removing a callback
- Fire the callback when presence changes in either direction. Previously it would only fire when the user becomes present after a period of inactivity.
- Ensure callbacks are only called once for each state change. Previously they would be called every 60s, regardless of the value
- Listen to the `visibilitychanged` and `focus` events, treating them as equivalent to user action. This will make messagebus re-activate more quickly when switching back to a stale tab
- Add test helpers
- Delete the unused `discourse/lib/page-visible` module.
- Call message-bus's onVisibilityChange API directly, rather than dispatching a fake event on the `document`
But if anything, I would have expected that to make scrolling smoother , not worse! (I switched this particular feature to use āpassiveā event listeners, rather than blocking event listeners)
Do you have the same problem on try.discourse.org ?
As an experiment, I just made a theme here on Meta which removes those updated event listeners. https://meta.discourse.org/?preview_theme_id=260 (Named āExperiment - remove scroll listenerā in the hamburger) Does this theme fix the lagging for you?
3 Likes
Don
November 26, 2021, 1:04pm
3
Hi David,
Thank you for the quick response. Unfortunately there is the same issue on try and the Experiment - remove scroll listener theme too.
2 Likes
david
(David Taylor)
November 26, 2021, 1:05pm
4
Thanks for checking! In a way Iām glad that didnāt fix it, because I have no idea why that change would cause worse performance!
Iāll do another comb through recent commits and see if I can spot anything suspicious
Would you mind letting us know the make/model of your device, so I can try to reproduce in a simulator?
2 Likes
Don
November 26, 2021, 1:10pm
5
On second thought, yes, it is positive
Sure my device is a Huawei P20 Pro
2 Likes
Falco
(Falco)
November 26, 2021, 1:30pm
6
Cant repro this on my phone on either Chrome or Firefox.
4 Likes
Osama
November 26, 2021, 4:03pm
7
I can repro here on Meta using my Pixel 4 XL running Android 12. I didnāt notice it until I read this topic. The best way to see it is to scroll short distances (~2cm on the screen) repeatedly.
3 Likes
david
(David Taylor)
November 26, 2021, 4:34pm
8
I made this improvement:
committed 03:25PM - 26 Nov 21 UTC
Calling `setProperty("--header-offset", newValue)` will always cause a 'Recalculā¦ ate Style' event, even if the value is unchanged. On my browser, these 'Recalculate Style' events take about 6-7ms each time the `dockCheck` function is run.
This commit stores the 'previous' value in an instance variable, and only calls setProperty if the value has changed. This brings the total runtime of `dockCheck` down to about 70Āµs on my machine.
Which is now deployed to meta. Does that feel any better @Don ?
That issue isnāt new though, so Iām not sure why it only started being noticeable in the last couple of days
6 Likes
Don
November 26, 2021, 4:37pm
9
David now it is perfect Thank you!
I saw yesterday a commit about software update prompt Maybe that is related with this issue?
5 Likes
david
(David Taylor)
November 26, 2021, 4:41pm
10
Glad to hear it!
Oh yes, youāre absolutely right! I totally missed that. This commit from yesterday refactored the --header-offset
logic so that it runs all the time, rather than āonly when dockedā. That slowed down scroll performance. My fix made that logic more efficient, so thatās why itās working now.
8 Likes