- Issue created by @poker10
- π©πͺGermany jan kellermann
In original documentation of klaro-js the loading with "defer" is recommended.
We run in some race-conditions with our own drupal integration and removed the defer-flag.We will check this again - unfortunately, the impact assessment is not trivial.
- π©πͺGermany jurgenhaas Gottmadingen
When removing
klaro
as a function argument in line 1, this causes follow-up issues, e.g. in line 15, line 39 and below, where the klaro object is being referenced. I'm not sure how that can be resolved. Tha browser console prints error messages "klaro is not defined". - π©πͺGermany Anybody Porta Westfalica
FYI: I think
defer
would be the right choice logically and based on our experiences with COOKiES. Still if claro is loaded at the end of the page, the effect should be minimal.
See similar comments here: π COOKiES increases LCP a lot (Google pagespeed) Active - π¬π§United Kingdom catch
Does the Klaro Drupal js need to be set to preprocess: false and also set to defer to match? Then the browser should still load the klaro library first, which would mean all the js ought to continue to work then.
- π©πͺGermany jan kellermann
Yes, I suppose. This is on our list of measures. However, this also delays the rendering of the contextual content dialogs - which probably leads to a worsening of the LCP e.g. for a YouTube video on the start page.
- π¬π§United Kingdom catch
I personally would not be too worried about making LCP of a youtube video worse, because it's already bad, and using something like https://www.drupal.org/project/lite_youtube_embed β would make it much better, and mean that third party js would only be loaded when it's interacted with, not when the page is loaded.
No idea how that module interacts with Klaro though, if it blocks the lite youtube render too, then that'd be trickier.
Also all the pages without a youtube embed would be faster anyway.
-
jan kellermann β
committed 8e559228 on 3.x
#3493822: Defer loading of library.
-
jan kellermann β
committed 8e559228 on 3.x
- π©πͺGermany jan kellermann
Thank you for feedback and testing.
I merged the code.
- π©πͺGermany Anybody Porta Westfalica
Great work @jan kellermann thank you!!