Awaiting feedback XF.autoFocusWithin in alerts causing unexpected slowdowns

Xon

Well-known member
Affected version
2.1.4
I've had numerous reports on my sites since moving to XF2 about unexpected slowdowns. Looking at chrome performance tools there is a "Forced reflow is a likely performance bottleneck. ", with the link to within XF.autoFocusWithin.
 
Rather behind on this bug, but is this still something that appears to be happening? (In terms of actually causing some sort of performance issue.)

This method can trigger a reflow, mostly because for part of it, we need to read scroll states for parent elements and restore them after the focus happens (prevents an unexpected page scroll in some cases). The thing is, this method only tends to get called for things like menu opening or overlay display, so there are a lot of other things happening as well. If there is a bit of a slowdown, it would only be in that specific situation.

We might be able to make some tweaks here though in my checks of the devtools, the layout/recalculate style parts of this method are very small. Most of the work seems to be related to the focus actually happening (the events being triggered, etc). So overall, I don't think it's likely for changes here to have a significant effect.
 
Top Bottom