- Issue created by @Grimreaper
- ๐ฉ๐ชGermany jurgenhaas Gottmadingen
I wonder if this module should even remove the usage of that library. According to the comment in
navigation.libraries.yml
, this should not be done:# Internal library. Do not depend on it outside core nor add core usage # beyond the Navigation module.
Hey,
I have added the condition to attach the library using hook_library_alter instead of hook_page_attachments ( which was attaching it directly).
Please have a look and let me know if there are any changes need to made here ( as suggested by @jurgenhaas )
I am attaching a screenshot for console when a anonymous user visits the site, no error is present.
Thank you.- ๐ง๐ชBelgium svendecabooter Gent
I can confirm that this patch fixes the bug described in ๐ admin-toolbar-wrapper: Uncaught TypeError: doc.querySelector(...) is null Active .
Also, without this patch the following files get added to our frontend theme, for anonymous users that do not see the navigation bar:
- core/modules/navigation/css/components/admin-toolbar.css
- core/modules/navigation/js/admin-toolbar-wrapper.jsCode in these files interfered with our theme, which is resolved with this fix.
- Status changed to RTBC
6 days ago 11:04pm 7 March 2025 - ๐ฎ๐ชIreland lostcarpark
Thanks for raising this. Clearly the library should only be loaded when the navigation is loaded, and certainly not for anonymous users.
Merging.
-
lostcarpark โ
committed 93fd4304 on 1.1.x authored by
anish.ir โ
Resolve #3497060 "Add library only"
-
lostcarpark โ
committed 93fd4304 on 1.1.x authored by
anish.ir โ
- ๐ฎ๐ชIreland lostcarpark
Merged.
There are a couple of warnings about deprecations for next minor/max PHP, but we'll take care of those in separate issues.
@Jurgan, you make a good point about depending on the internal Navigation internal library. I think it would be worth looking at better ways to do that, but I think it should be in a follow-up issue.