Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some jQuery listeners in core js files attached twice when EU Cookie Compliance is enabled #5681

Open
argiepiano opened this issue Jul 10, 2022 · 0 comments

Comments

@argiepiano
Copy link

argiepiano commented Jul 10, 2022

Description of the bug

I'm unsure if this is a core issue, or a problem with EU Cookie Compliance, or both. This was originally reported in the forum, and there is a new issue in the EU Cookie Compliance module. I'm posting it here as well in case this is a problem with core.

There are at least two JS files with event listeners attached to more/less toggle links which are being attached twice: modules.js and status.js. This causes the listener to fire twice, effectively canceling the action (open/close of toggle in rapid succession - this can only be detected with a JS breakpoint, as it's not visually possible to detect).

Steps To Reproduce

  1. Install EU Cookie Compliance
  2. Visit admin/modules/list and admin/reports/status
  3. Click the more/less toggle -nothing seems to happen (no opening or closing)

To verify this is called twice:

  1. Deselect "Aggregate Javascript files" in admin/config/development/performance . Navigate to admin/modules/list
  2. In Chrome's dev tools -> Sources, find modules.js and insert a breakpoint in line 20
  3. Click the more/less toggle and watch the callback function being called twice

Additional information

Some other js files like contextual.js seem unaffected. One thing I noticed is that contextual.js wraps all the listener attachments with a jQuery.once(), which effectively avoids the double-attachment of listeners. So, I'm wondering if jQuery.once() should also be used in modules.js and status.js to wrap these attachers?

  • Backdrop CMS version: 1.22.0
  • Chrome v. 103
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant