Frozen menus and JS error since the Drupal 10.4.0 update

Created on 6 January 2025, 4 days ago

Problem/Motivation

I use 'Matomo Noscript' without the 'Matomo' module installed, and have configured the settings in my 'settings.php' file. Everything worked correctly until Drupal 10.3.
Since the update to Drupal 10.4.0, after having logged in, there are issues with the menus and the search block of my default theme and even with the Drupal admin menu: once logged in, it's currently impossible to open the search box or to fold / unfold the menus, on small screens as well as on large screens: they all freeze.
None of these issues occur when logged out.
Concerning the Drupal admin menu, the issue appears only while using the main theme, not the Claro administration theme (where the admin menu behaves correctly).
Now, when I remove the Matomo Noscript configuration from my 'settings.php' file, everything comes back to normal, except of course the Matomo Noscript analytics, which can't run anymore.

In Firefox Inspector, here's the issue displayed:

((drupalSettings)=>navigator.sendBeacon(`${drupalSettings.piwikNoscript.url}&urlref=${encodeURIComponent(document.referrer)}`))(drupalSettings);;
Uncaught TypeError: drupalSettings.piwikNoscript is undefined
    <anonymous> https://mysite/sites/default/files/js/js_HRloSDgTpLEq_RSmdPNK7Noo2moK9eubM74sx_XVN1U.js?scope=footer&delta=6&language=en&theme=solo&include=eJx9kGFuwzAIhS9kx2fYSSzi0BSFGAvsbbn9nLZpumraHxs-HgIeTFMVyFuARzBcVHJ10KqwzNJqmLQV4OEkbqQ5FioYjsCl3oPftQEf8pN4przY_5IqwiNoFyk-B6ZKn3jrdthiElkI-7cWJsgJw1_QXcmq6BZW0MWDeUWYXAGFWaFc49jyxBgZtv20J_d37u_cFfqiJWaxpFS67FfqFK1Itr5cXDE3C-8gGvV90Fk3LOyPvzRmLwUS1e0Fzywj8AvY251VqP0KSnZYcRL3cCocjr3lA1qCgh_TSrnX2l5o-gPEQr_6:5
    <anonymous> https://mysite/sites/default/files/js/js_HRloSDgTpLEq_RSmdPNK7Noo2moK9eubM74sx_XVN1U.js?scope=footer&delta=6&language=en&theme=solo&include=eJx9kGFuwzAIhS9kx2fYSSzi0BSFGAvsbbn9nLZpumraHxs-HgIeTFMVyFuARzBcVHJ10KqwzNJqmLQV4OEkbqQ5FioYjsCl3oPftQEf8pN4przY_5IqwiNoFyk-B6ZKn3jrdthiElkI-7cWJsgJw1_QXcmq6BZW0MWDeUWYXAGFWaFc49jyxBgZtv20J_d37u_cFfqiJWaxpFS67FfqFK1Itr5cXDE3C-8gGvV90Fk3LOyPvzRmLwUS1e0Fzywj8AvY251VqP0KSnZYcRL3cCocjr3lA1qCgh_TSrnX2l5o-gPEQr_6:5
js_HRloSDgTpLEq_RSmdPNK7Noo2moK9eubM74sx_XVN1U.js:5:44
    <anonymous> https://mysite/sites/default/files/js/js_HRloSDgTpLEq_RSmdPNK7Noo2moK9eubM74sx_XVN1U.js?scope=footer&delta=6&language=en&theme=solo&include=eJx9kGFuwzAIhS9kx2fYSSzi0BSFGAvsbbn9nLZpumraHxs-HgIeTFMVyFuARzBcVHJ10KqwzNJqmLQV4OEkbqQ5FioYjsCl3oPftQEf8pN4przY_5IqwiNoFyk-B6ZKn3jrdthiElkI-7cWJsgJw1_QXcmq6BZW0MWDeUWYXAGFWaFc49jyxBgZtv20J_d37u_cFfqiJWaxpFS67FfqFK1Itr5cXDE3C-8gGvV90Fk3LOyPvzRmLwUS1e0Fzywj8AvY251VqP0KSnZYcRL3cCocjr3lA1qCgh_TSrnX2l5o-gPEQr_6:5
    <anonymous> https://mysite/sites/default/files/js/js_HRloSDgTpLEq_RSmdPNK7Noo2moK9eubM74sx_XVN1U.js?scope=footer&delta=6&language=en&theme=solo&include=eJx9kGFuwzAIhS9kx2fYSSzi0BSFGAvsbbn9nLZpumraHxs-HgIeTFMVyFuARzBcVHJ10KqwzNJqmLQV4OEkbqQ5FioYjsCl3oPftQEf8pN4przY_5IqwiNoFyk-B6ZKn3jrdthiElkI-7cWJsgJw1_QXcmq6BZW0MWDeUWYXAGFWaFc49jyxBgZtv20J_d37u_cFfqiJWaxpFS67FfqFK1Itr5cXDE3C-8gGvV90Fk3LOyPvzRmLwUS1e0Fzywj8AvY251VqP0KSnZYcRL3cCocjr3lA1qCgh_TSrnX2l5o-gPEQr_6:5

Steps to reproduce

In D10.3, install 'Matomo Noscript' as a standalone module (without 'Matomo' module), put the required configuration in the 'settings.php' file. Once logged in, try to fold / unfold the menus or the search box: it does work.
Now update to D10.4, try to fold / unfold the menus or the search box again: it doesn't work anymore but produces a JS error.
Finally remove the required configuration from the 'settings.php' file and repeat the test: it does work again.

Proposed resolution

Unfreeze the menus and the search box and remove the JS error in D10.4.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

πŸ› Bug report
Status

Active

Version

1.15

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @joel_guesclin
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    @joel_guesclin the error method suggests that your theme is somehow executing the javascript before drupalSettings have been defined?

    The javascript for this module defines core/drupalSettings as one of its dependencies, so I would have thought that this shouldn't happen..

    i.e. with javascript aggregation disabled, you should see <script type="application/json" data-drupal-selector="drupal-settings-json"> which contains something like "piwikNoscript":{"url":"https:\/\/example.test... and then further down <script src="/core/misc/drupalSettingsLoader.js"></script> and then still further down <script src="/modules/contrib/piwik_noscript/piwik_noscript.js?v=1.13.0"></script>

  • Hello,

    After having disabled the JS aggregation and cleared the cache, then the issue disappeared. As soon as I re-enable it, then the issue is back.
    Nonetheless, there's another JS error displaying when the JS aggregation is disabled:

    Uncaught TypeError: drupalSettings.piwikNoscript is undefined
        <anonymous> https://fi9ama-www.ddev.site/modules/contrib/piwik_noscript/piwik_noscript.js?v=1.13.0:8
        <anonymous> https://fi9ama-www.ddev.site/modules/contrib/piwik_noscript/piwik_noscript.js?v=1.13.0:11
    piwik_noscript.js:8:8
        <anonymous> https://fi9ama-www.ddev.site/modules/contrib/piwik_noscript/piwik_noscript.js?v=1.13.0:8
        <anonymous> https://fi9ama-www.ddev.site/modules/contrib/piwik_noscript/piwik_noscript.js?v=1.13.0:11
    

    Firefox Inspector links this error to this file:

    modules/contrib/piwik_noscript/piwik_noscript.js?v=1.13.0

    whose content is:

    /**
     * @file
     * Add referrer URL tracking to Matomo tracking code.
     */
    
    ((drupalSettings) =>
      navigator.sendBeacon(
        `${drupalSettings.piwikNoscript.url}&urlref=${encodeURIComponent(
          document.referrer,
        )}`,
      ))(drupalSettings);
    
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    @joel_guesclin you confirmed that you have basically the same error with javascript aggregation disabled, but you didn't confirm what you see in the page source when the error occurs. Do you see the markup I described in #2 or are they in a different order, or is something missing?

  • Merge request !6Defer beacon β†’ (Merged) created by mfb
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    @joel_guesclin I still have no idea what could cause this, but I created a merge request that you could try applying to see if it resolves the error. Basically we could defer firing off the beacon until the document is loaded - hopefully by then the drupalSettings are properly available?

  • Sorry, I forgot the page source indeed. Here are the results.

    1) With the Claro administration theme, where no error occurs.

    Line 177:

      <script type="application/json" data-drupal-selector="drupal-settings-json">{"path":{"baseUrl":"\/","pathPrefix":"en\/","currentPath":"admin","currentPathIsAdmin":true,"isFront":false,"currentLanguage":"en"},"pluralDelimiter":"\u0003","suppressDeprecationErrors":true,"ajaxPageState":{"libraries":"eJx9UGtyxCAIvpDGM_QkGWJolgkRR3D7OH3NbkxmO53-ku8FCFQTlkWqhbnUDDzAybiJljFTxtALFxmKdGeCuzeY9GAXlgnYq30xpcVFSYafVoG7_2J8c6z6v8VEeILSTAXP3aLRHR_pJ5-kbMD0jQ7rGEVWwvZsmQlSxPAXOc74DpXNZSiwFMi3capp5t3ThicLp-Cfgj8ED_NG6crpEdQroUdEu5c-aB2TaCyUW-cX6PQmxeJ1-o7d8ffQb_ALD6gRMr49RpjUXajFVcXSW-31QG1x_QHOBL2q","theme":"claro","theme_token":"Krtw8JdC_Qi5QmKAkd513Bz2JLCGFqEiIqBXBWXLGwM"},"ajaxTrustedUrl":[],"bigPipePlaceholderIds":{"callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages\u0026args%5B0%5D\u0026token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA":true,"callback=user.toolbar_link_builder%3ArenderToolbarLinks\u0026\u0026token=QPmvukHqpEJJ4rYEzUUFx0ERxrtfmQ9TMOp_hvyLHEk":true,"callback=user.toolbar_link_builder%3ArenderDisplayName\u0026\u0026token=XGROnxBLjNjdNZJ_VcOhVZtenx2tDkIKPfojS_uZFXA":true,"callback=shortcut.lazy_builders%3AlazyLinks\u0026\u0026token=5-XBI-QHgyU_l7Bu0FizHR7YBqK2bTVTBFF8Z0DVTis":true},"eu_cookie_compliance":{"cookie_policy_version":"1.0.0","popup_enabled":true,"popup_agreed_enabled":false,"popup_hide_agreed":false,"popup_clicking_confirmation":false,"popup_scrolling_confirmation":false,"popup_html_info":"\u003Cdiv aria-labelledby=\u0022popup-text\u0022  class=\u0022eu-cookie-compliance-banner eu-cookie-compliance-banner-info eu-cookie-compliance-banner--opt-in\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info eu-cookie-compliance-content\u0022\u003E\n        \u003Cdiv id=\u0022popup-text\u0022 class=\u0022eu-cookie-compliance-message\u0022 role=\u0022document\u0022\u003E\n      \u003Ch2\u003EWe use cookies on this site to enhance your user experience\u003C\/h2\u003E\u003Cp\u003EBy clicking the Accept button, you agree to us doing so.\u003C\/p\u003E\n          \u003C\/div\u003E\n\n    \n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-buttons\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022 class=\u0022agree-button eu-cookie-compliance-secondary-button\u0022\u003EAccept\u003C\/button\u003E\n              \u003Cbutton type=\u0022button\u0022 class=\u0022decline-button eu-cookie-compliance-default-button\u0022\u003ENo, thanks\u003C\/button\u003E\n          \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E","use_mobile_message":false,"mobile_popup_html_info":"\u003Cdiv aria-labelledby=\u0022popup-text\u0022  class=\u0022eu-cookie-compliance-banner eu-cookie-compliance-banner-info eu-cookie-compliance-banner--opt-in\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info eu-cookie-compliance-content\u0022\u003E\n        \u003Cdiv id=\u0022popup-text\u0022 class=\u0022eu-cookie-compliance-message\u0022 role=\u0022document\u0022\u003E\n      \n          \u003C\/div\u003E\n\n    \n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-buttons\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022 class=\u0022agree-button eu-cookie-compliance-secondary-button\u0022\u003EAccept\u003C\/button\u003E\n              \u003Cbutton type=\u0022button\u0022 class=\u0022decline-button eu-cookie-compliance-default-button\u0022\u003ENo, thanks\u003C\/button\u003E\n          \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E","mobile_breakpoint":768,"popup_html_agreed":false,"popup_use_bare_css":false,"popup_height":"auto","popup_width":"100%","popup_delay":1000,"popup_link":"\/en","popup_link_new_window":true,"popup_position":false,"fixed_top_position":true,"popup_language":"en","store_consent":false,"better_support_for_screen_readers":false,"cookie_name":"","reload_page":false,"domain":"","domain_all_sites":false,"popup_eu_only":false,"popup_eu_only_js":false,"cookie_lifetime":100,"cookie_session":0,"set_cookie_session_zero_on_disagree":0,"disagree_do_not_show_popup":false,"method":"opt_in","automatic_cookies_removal":true,"allowed_cookies":"","withdraw_markup":"\u003Cbutton type=\u0022button\u0022 class=\u0022eu-cookie-withdraw-tab\u0022\u003EPrivacy settings\u003C\/button\u003E\n\u003Cdiv aria-labelledby=\u0022popup-text\u0022 class=\u0022eu-cookie-withdraw-banner\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info eu-cookie-compliance-content\u0022\u003E\n    \u003Cdiv id=\u0022popup-text\u0022 class=\u0022eu-cookie-compliance-message\u0022 role=\u0022document\u0022\u003E\n      \u003Ch2\u003EWe use cookies on this site to enhance your user experience\u003C\/h2\u003E\u003Cp\u003EYou have given your consent for us to set cookies.\u003C\/p\u003E\n    \u003C\/div\u003E\n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-buttons\u0022\u003E\n      \u003Cbutton type=\u0022button\u0022 class=\u0022eu-cookie-withdraw-button \u0022\u003EWithdraw consent\u003C\/button\u003E\n    \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E","withdraw_enabled":true,"reload_options":0,"reload_routes_list":"","withdraw_button_on_info_popup":false,"cookie_categories":[],"cookie_categories_details":[],"enable_save_preferences_button":true,"cookie_value_disagreed":"0","cookie_value_agreed_show_thank_you":"1","cookie_value_agreed":"2","containing_element":"body","settings_tab_enabled":false,"olivero_primary_button_classes":"","olivero_secondary_button_classes":"","close_button_action":"close_banner","open_by_default":false,"modules_allow_popup":true,"hide_the_banner":true,"geoip_match":true},"autologout":{"timeout":43200000,"timeout_padding":60000,"message":"We are about to log you out for inactivity. If we do, you will lose any unsaved work. Do you need more time?","redirect_url":"\/en\/user\/login?destination=\/en\/admin\u0026autologout_timeout=1","title":"mysite Alert","refresh_only":true,"no_dialog":false,"disable_buttons":false,"yes_button":"Yes","no_button":"No","use_alt_logout_method":false,"logout_regardless_of_activity":false,"modal_width":450},"toolbar":{"breakpoints":{"toolbar.narrow":"only screen and (min-width: 16.5em)","toolbar.standard":"only screen and (min-width: 38.125em)","toolbar.wide":"only screen and (min-width: 61em)"},"subtreesHash":"lyrcLhUd9hilM-Sers3S3r5Xu86YyO9ESR56IKR2uzY"},"user":{"uid":"1","permissionsHash":"is-admin"},"piwikNoscript":{"url":"https:\/\/matomo.example.org\/js\/?action_name=Administration\u0026idsite=1\u0026rec=1\u0026url=https%3A\/\/mysite\/en\/admin\u0026send_image=0"}}</script>
    

    which contains:

    "piwikNoscript":{"url":"https:\/\/matomo.example.org...
    

    Line 182:

    <script src="/core/misc/drupalSettingsLoader.js?v=10.4.0"></script>
    

    Line 239:

    <script src="/modules/contrib/piwik_noscript/piwik_noscript.js?v=1.13.0"></script>
    

    2) With the Solo main theme, when errors occur.

    Line 20:

        <script type="application/json" data-drupal-selector="drupal-settings-json">{"path":{"baseUrl":"\/","pathPrefix":"en\/","currentPath":"node\/7","currentPathIsAdmin":false,"isFront":true,"currentLanguage":"en"},"pluralDelimiter":"\u0003","suppressDeprecationErrors":true,"ajaxPageState":{"libraries":"eJyVUsFuwyAM_SEcpO20474kMuAmKAQjDO3y9yNt0nTtNGkXsJ_fM8Y2OlcY46JxM7pT5lgU1sKBB65Fu1wThu5AlPFDn3wivRvKNg19lYphpx8IBB8n-ZtSmIPB3EiZ7g_a4s90VSuqvWWePLVrTsFjtKR_A3tHJ6yhqNFL4bzoGfMEKJAJnUqYcciYxt7U6MIqbCXEou8BuAVgC4BBoVdZwGXtzIvqhv-XD8n0_cfH26GTvQcH0tWYqgleRnr4h2wvyJFbtuSiMkniKK2J_Uyxin4GevGtb6Rk5FzsMerdV9Imrtej9SNwbqcjB7JIoRkKGnlgnGoIwAmtL8sDPAQ2GF4AMG0gU2Ifi4AYWL9_cNbqntwfgjk-CbaSZhLBgQRcm_pDuGaDEdpCRAIZ0fFlq_zyDlaaXbC0ffH23vgDUbfc-roJ257qfV-f_I7EYqJPN_vYYnUN1KyqUN4Tr3bn23qJOnu6iL6e3cyuBvoGiqBiaw","theme":"solo","theme_token":null},"ajaxTrustedUrl":{"\/en\/search\/node":true},"bigPipePlaceholderIds":{"callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages\u0026args%5B0%5D\u0026token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA":true,"callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder\u0026args%5B0%5D=solo_languageswitcher\u0026args%5B1%5D=full\u0026args%5B2%5D\u0026token=DOm0JWYWzwYP2LRpB2Ndt3LIcGVIagpiThQlTib5XYg":true,"callback=user.toolbar_link_builder%3ArenderToolbarLinks\u0026\u0026token=QPmvukHqpEJJ4rYEzUUFx0ERxrtfmQ9TMOp_hvyLHEk":true,"callback=user.toolbar_link_builder%3ArenderDisplayName\u0026\u0026token=XGROnxBLjNjdNZJ_VcOhVZtenx2tDkIKPfojS_uZFXA":true,"callback=shortcut.lazy_builders%3AlazyLinks\u0026\u0026token=5-XBI-QHgyU_l7Bu0FizHR7YBqK2bTVTBFF8Z0DVTis":true},"responsive_menus":[{"toggler_text":"\u2630 Menu","selectors":["#main-menu"],"media_size":768,"media_unit":"px","absolute":1,"disable_mouse_events":0,"remove_attributes":1,"responsive_menus_style":"responsive_menus_simple"}],"eu_cookie_compliance":{"cookie_policy_version":"1.0.0","popup_enabled":true,"popup_agreed_enabled":false,"popup_hide_agreed":false,"popup_clicking_confirmation":false,"popup_scrolling_confirmation":false,"popup_html_info":"\u003Cdiv aria-labelledby=\u0022popup-text\u0022  class=\u0022eu-cookie-compliance-banner eu-cookie-compliance-banner-info eu-cookie-compliance-banner--opt-in\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info eu-cookie-compliance-content\u0022\u003E\n        \u003Cdiv id=\u0022popup-text\u0022 class=\u0022eu-cookie-compliance-message\u0022 role=\u0022document\u0022\u003E\n      \u003Ch2\u003EWe use cookies on this site to enhance your user experience\u003C\/h2\u003E\u003Cp\u003EBy clicking the Accept button, you agree to us doing so.\u003C\/p\u003E\n          \u003C\/div\u003E\n\n    \n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-buttons\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022 class=\u0022agree-button eu-cookie-compliance-secondary-button\u0022\u003EAccept\u003C\/button\u003E\n              \u003Cbutton type=\u0022button\u0022 class=\u0022decline-button eu-cookie-compliance-default-button\u0022\u003ENo, thanks\u003C\/button\u003E\n          \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E","use_mobile_message":false,"mobile_popup_html_info":"\u003Cdiv aria-labelledby=\u0022popup-text\u0022  class=\u0022eu-cookie-compliance-banner eu-cookie-compliance-banner-info eu-cookie-compliance-banner--opt-in\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info eu-cookie-compliance-content\u0022\u003E\n        \u003Cdiv id=\u0022popup-text\u0022 class=\u0022eu-cookie-compliance-message\u0022 role=\u0022document\u0022\u003E\n      \n          \u003C\/div\u003E\n\n    \n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-buttons\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022 class=\u0022agree-button eu-cookie-compliance-secondary-button\u0022\u003EAccept\u003C\/button\u003E\n              \u003Cbutton type=\u0022button\u0022 class=\u0022decline-button eu-cookie-compliance-default-button\u0022\u003ENo, thanks\u003C\/button\u003E\n          \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E","mobile_breakpoint":768,"popup_html_agreed":false,"popup_use_bare_css":false,"popup_height":"auto","popup_width":"100%","popup_delay":1000,"popup_link":"\/en","popup_link_new_window":true,"popup_position":false,"fixed_top_position":true,"popup_language":"en","store_consent":false,"better_support_for_screen_readers":false,"cookie_name":"","reload_page":false,"domain":"","domain_all_sites":false,"popup_eu_only":false,"popup_eu_only_js":false,"cookie_lifetime":100,"cookie_session":0,"set_cookie_session_zero_on_disagree":0,"disagree_do_not_show_popup":false,"method":"opt_in","automatic_cookies_removal":true,"allowed_cookies":"","withdraw_markup":"\u003Cbutton type=\u0022button\u0022 class=\u0022eu-cookie-withdraw-tab\u0022\u003EPrivacy settings\u003C\/button\u003E\n\u003Cdiv aria-labelledby=\u0022popup-text\u0022 class=\u0022eu-cookie-withdraw-banner\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info eu-cookie-compliance-content\u0022\u003E\n    \u003Cdiv id=\u0022popup-text\u0022 class=\u0022eu-cookie-compliance-message\u0022 role=\u0022document\u0022\u003E\n      \u003Ch2\u003EWe use cookies on this site to enhance your user experience\u003C\/h2\u003E\u003Cp\u003EYou have given your consent for us to set cookies.\u003C\/p\u003E\n    \u003C\/div\u003E\n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-buttons\u0022\u003E\n      \u003Cbutton type=\u0022button\u0022 class=\u0022eu-cookie-withdraw-button \u0022\u003EWithdraw consent\u003C\/button\u003E\n    \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E","withdraw_enabled":true,"reload_options":0,"reload_routes_list":"","withdraw_button_on_info_popup":false,"cookie_categories":[],"cookie_categories_details":[],"enable_save_preferences_button":true,"cookie_value_disagreed":"0","cookie_value_agreed_show_thank_you":"1","cookie_value_agreed":"2","containing_element":"body","settings_tab_enabled":false,"olivero_primary_button_classes":"","olivero_secondary_button_classes":"","close_button_action":"close_banner","open_by_default":true,"modules_allow_popup":true,"hide_the_banner":false,"geoip_match":true},"autologout":{"timeout":86400000,"timeout_padding":60000,"message":"We are about to log you out for inactivity. If we do, you will lose any unsaved work. Do you need more time?","redirect_url":"\/en\/user\/login?destination=\/en\/home_page\u0026autologout_timeout=1","title":"mysite Alert","refresh_only":false,"no_dialog":false,"disable_buttons":false,"yes_button":"Yes","no_button":"No","use_alt_logout_method":false,"logout_regardless_of_activity":false,"modal_width":450},"statistics":{"data":{"nid":"7"},"url":"\/core\/modules\/statistics\/statistics.php"},"history":{"nodesToMarkAsRead":{"7":true}},"toolbar":{"breakpoints":{"toolbar.narrow":"only screen and (min-width: 16.5em)","toolbar.standard":"only screen and (min-width: 38.125em)","toolbar.wide":"only screen and (min-width: 61em)"},"subtreesHash":"lyrcLhUd9hilM-Sers3S3r5Xu86YyO9ESR56IKR2uzY"},"user":{"uid":"1","permissionsHash":"is-admin"}}</script>
    

    which doesn't contain any 'piwikNoscript' chain;

    Line 23:

    <script src="/core/misc/drupalSettingsLoader.js?v=10.4.0"></script>
    

    Line 950:

    <script src="/modules/contrib/piwik_noscript/piwik_noscript.js?v=1.13.0"></script>
    

    I'll be able to apply your merge request later, and will come back soon after.

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    Well that's pretty strange that piwikNoscript is completely missing from drupalSettings, as it's explicitly added by code in piwik_noscript.module

    Re: your "steps to reproduce," are you able to reproduce this bug on a clean install of Drupal 10.4? I wasn't able to.

    In order to resolve this I would need steps to reproduce the issue from a clean install of Drupal, such as install this theme or install that module. I did try installing "solo" theme from drupal.org but piwikNoscript was still showing up in drupalSettings.

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    Well, I was able to hack together a custom module that might be reproducing this issue

    I suspect this might be caused by drupalSettings being loaded in the <head> element, as you mentioned in #8.

    Do you have a contrib or custom module with a library that specifies header: true and depends on core/drupalSettings?

    Also, could you try disabling BigPipe module - this might resolve that particular issue.

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    Filed an issue for the core bug I seem to have found: πŸ› Placeholders cannot attach drupalSettings if drupalSettings was loaded in header Active

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    Since this seems to be a bug / limitation in Drupal core, I haven't yet figured out a way to get things working with drupalSettings being loaded in the <head> and BigPipe enabled.

    At the very least we could fail silently - just do not send the beacon if drupalSettings.piwikNoscript is missing. This has the disadvantage, however, of not notifying site admins about the broken functionality :/

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    @joel_guesclin if you're able to track down a contrib module you're using with a library that specifies header: true and depends on core/drupalSettings, that would seem to be what's triggering this issue - at least in my testing.

  • I haven't found exactly what you asked for, nonetheless here are the results:

    myuser@mypc:~$ cd ~/dev/myproject/mysite/docroot/modules/contrib
    myuser@mypc:~/dev/myproject/mysite/docroot/modules/contrib$ grep -r 'header\:\ true' .
    myuser@mypc:~/dev/myproject/mysite/docroot/modules/contrib$ grep -r 'core\/drupalSettings' .
    ./paragraphs_bundles/paragraphs_bundles.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/paragraphs_bundles.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/modules/paragraph_bundle_slideshow/paragraph_bundle_slideshow.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/modules/paragraph_bundle_accordion/paragraph_bundle_accordion.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/modules/paragraph_bundle_alert/paragraph_bundle_alert.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/modules/paragraph_bundle_modal/paragraph_bundle_modal.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/modules/paragraph_bundle_image_grid/paragraph_bundle_image_grid.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/modules/paragraph_bundle_tabs/paragraph_bundle_tabs.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/modules/paragraph_bundle_3d_carousel/paragraph_bundle_3d_carousel.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/modules/paragraph_bundle_image_background/paragraph_bundle_image_background.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/modules/paragraph_bundle_layout/paragraph_bundle_layout.libraries.yml:    - core/drupalSettings
    ./paragraphs_bundles/modules/paragraph_bundle_node_reference/paragraph_bundle_node_reference.libraries.yml:    - core/drupalSettings
    ./captcha/modules/image_captcha/image_captcha.libraries.yml:    - core/drupalSettings
    ./panels/panels_ipe/panels_ipe.libraries.yml:    - core/drupalSettings
    ./paragraphs/paragraphs.libraries.yml:    - core/drupalSettings
    ./paragraphs/paragraphs.libraries.yml:    - core/drupalSettings
    ./paragraphs/paragraphs.libraries.yml:    - core/drupalSettings
    ./paragraphs/paragraphs.libraries.yml:    - core/drupalSettings
    ./field_group/field_group.libraries.yml:    - core/drupalSettings
    ./autologout/autologout.libraries.yml:    - core/drupalSettings
    ./eu_cookie_compliance/eu_cookie_compliance.libraries.yml:    - core/drupalSettings
    ./piwik_noscript/piwik_noscript.libraries.yml:    - core/drupalSettings
    myuser@mypc:~/dev/myproject/mysite/docroot/modules/contrib$ cd ~/dev/myproject/mysite/docroot/themes/contrib/
    myuser@mypc:~/dev/myproject/mysite/docroot/themes/contrib$ grep -r 'header\:\ true' .
    ./solo/solo.libraries.yml:  header: true
    ./solo/solo.libraries.yml:  header: true
    ./solo/solo.libraries.yml:  header: true
    myuser@mypc:~/dev/myproject/mysite/docroot/themes/contrib$ grep -r 'core\/drupalSettings' .
    ./solo/solo.libraries.yml:    - core/drupalSettings
    ./solo/solo.libraries.yml:    - core/drupalSettings
    ./solo/solo.libraries.yml:    - core/drupalSettings
    ./solo/solo.libraries.yml:    - core/drupalSettings
    ./solo/solo.libraries.yml:    - core/drupalSettings
    myuser@mypc:~/dev/myproject/mysite/docroot/themes/contrib$ 
    
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    Ok, so we don't yet know why your drupalSettings is getting loaded in the <head> as opposed to in the <body> - it wouldn't be the "solo" theme since that doesn't have any libraries that specify both header: true and dependencies: core/drupalSettings

    You would probably need to give me all your installed modules (contrib and custom) so that I could try to reproduce it - or figure out on your own why drupalSettings is getting loaded in <head>

  • Here are the contrib modules enabled:

    myuser@myproject:/var/www/html/mysite$ drush pml --no-core --status enabled
     ------------------ ---------------------------------------------------------------------- --------- ---------------- 
      Package            Name                                                                   Status    Version         
     ------------------ ---------------------------------------------------------------------- --------- ---------------- 
      Other              AddToAny (addtoany)                                                    Enabled   2.0.7           
      Other              Automated Logout (autologout)                                          Enabled   2.0.1           
      Spam control       CAPTCHA (captcha)                                                      Enabled   8.x-1.16        
      Chaos tool suite   Chaos Tools (ctools)                                                   Enabled   4.1.0           
      Field types        Dynamic Entity Reference (dynamic_entity_reference)                    Enabled   3.2.0           
      Field types        Entity Reference Revisions (entity_reference_revisions)                Enabled   8.x-1.12        
      Entityqueue        Entityqueue (entityqueue)                                              Enabled   8.x-1.9         
      User interface     EU Cookie Compliance (eu_cookie_compliance)                            Enabled   8.x-1.25        
      Fields             Field Group (field_group)                                              Enabled   8.x-3.6         
      Spam control       Honeypot (honeypot)                                                    Enabled   2.2.0           
      jQuery UI          jQuery UI (jquery_ui)                                                  Enabled   8.x-1.7         
      jQuery UI          jQuery UI Draggable (jquery_ui_draggable)                              Enabled   2.1.0           
      jQuery UI          jQuery UI Droppable (jquery_ui_droppable)                              Enabled   2.1.0           
      Other              JavaScript Cookie Library (js_cookie)                                  Enabled   1.0.1           
      Other              Link checker (linkchecker)                                             Enabled   2.0.0           
      Layout             Page Manager (page_manager)                                            Enabled   8.x-4.0-rc3     
      Layout             Page Manager UI (page_manager_ui)                                      Enabled   8.x-4.0-rc3     
      Panels             Panels (panels)                                                        Enabled   8.x-4.8         
      Panels             Panels IPE (panels_ipe)                                                Enabled   8.x-4.8         
      Paragraphs         Paragraphs (paragraphs)                                                Enabled   8.x-1.18        
      Paragraphs         Paragraph Bundle Content (paragraph_bundle_content)                    Enabled   1.0.8           
      Paragraphs         Paragraph Bundle Image (paragraph_bundle_image)                        Enabled   1.0.8           
      Paragraphs         Paragraph Bundle Layout (paragraph_bundle_layout)                      Enabled   1.0.8           
      Paragraphs         Paragraph Bundle Views (paragraph_bundle_views)                        Enabled   1.0.8           
      Paragraphs         Paragraphs Bundles (paragraphs_bundles)                                Enabled   1.0.8           
      Security           Password Policy (password_policy)                                      Enabled   4.0.3           
      Security           Password Character Types Policy (password_policy_character_types)      Enabled   4.0.3           
      Security           Password Characters of Type Policy (password_policy_characters)        Enabled   4.0.3           
      Security           Password Consecutive Characters Policy (password_policy_consecutive)   Enabled   4.0.3           
      Security           Password Policy History (password_policy_history)                      Enabled   4.0.3           
      Security           Password Character Length Policy (password_policy_length)              Enabled   4.0.3           
      Security           Password Username Policy (password_policy_username)                    Enabled   4.0.3           
      Administration     Read Only Mode (readonlymode)                                          Enabled   8.x-1.3         
      User interface     Responsive Menus (responsive_menus)                                    Enabled   2.0.0-beta1     
      Search             Search 404 (search404)                                                 Enabled   2.1.2           
      Security           Security Review (security_review)                                      Enabled   2.0.2           
      Other              Token (token)                                                          Enabled   8.x-1.15        
      Other              Unique content field validation (unique_content_field_validation)      Enabled   1.1.1           
      Development        Unused Modules (unused_modules)                                        Enabled   8.x-1.5         
      Views              Views Reference Field (viewsreference)                                 Enabled   8.x-2.0-beta10  
      Solo               Solo (solo)                                                            Enabled   1.0.12          
     ------------------ ---------------------------------------------------------------------- --------- ---------------- 
    myuser@myproject:/var/www/html/mysite$
    

    After several tests, the issue completely disappears when 'Matomo Noscript' OR 'Solo' theme OR 'BigPipe' are uninstalled, the uninstallation of the last two resulting in the reappearance of the 'piwikNoscript' chain in the line starting with <script type="application/json" data-drupal-selector="drupal-settings-json"> in the page source.

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    @joel_guesclin Good news, I think I was able to work around the bug in core - please try the merge request version of piwik_noscript, or apply the patch.

    I did some refactoring to use automatically-created placeholders, rather than manually-created placeholders - this bypasses the bug in BigPipe module. The automatically-created placeholder is a bit silly, because it means we are executing javascript to place a noscript element, but this code path allows BigPipe to apply drupalSettings correctly.

  • joel_guesclin β†’ changed the visibility of the branch 3497685-frozen-menus-and to hidden.

  • joel_guesclin β†’ changed the visibility of the branch 3497685-frozen-menus-and to active.

  • I applied the '9ad841f2' patch and it works, the menus and the search box are now unfrozen!
    Now the 'piwikNoscript' chain has comme back at the very bottom of the <body> element.
    I'm going to try the next patches and come back soon.

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    Ok great, I'll roll a new release soon.

    It would also be nice to fix the underlying bug in BigPipe module, but I haven't figured that out yet. At the very least I should be able to write a failing test..

    • mfb β†’ committed 8c555b0a on 8.x-1.x
      Issue #3497685 by mfb, joel_guesclin: Frozen menus and JS error since...
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco
  • On a locally restored website, I've updated the module to version 1.16 and can confirm the issue has gone after that.
    May thanks for the help and the work done!

Production build 0.71.5 2024