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

Dashboard's "Manage taxonomies" block loads dropbuttons library even if empty #6256

Open
argiepiano opened this issue Oct 8, 2023 · 0 comments

Comments

@argiepiano
Copy link

argiepiano commented Oct 8, 2023

Description of the bug

When you use the Dashboard's "Manage taxonomies" block, the dropbutton JS library is loaded even if that block is not rendered. This can happen if the user has no privileges to administer/edit/etc taxonomy terms or vocabularies. While loading the JS dropbutton library when there are no dropbuttons on the page may seem harmless, it actually creates problems with code introduced in #6180, which has a bug I'll report separately.

Steps To Reproduce

To reproduce this, we'll force an error that happens because of the combination of this bug, and another introduced by #6180. I will report that second bug in a separate issue.

To reproduce the behavior:

  1. Be sure you have vanilla, clean install of Backdrop 1.26.1
  2. Create an Editor user
  3. Remove all taxonomy privileges from the Editor role
  4. Log in as Editor, head to the Dashboard, and inspect the browser dev console
  5. You should see jQuery.Deferred exception: Cannot read properties of undefined (reading 'split') TypeError: Cannot read properties of undefined (reading 'split')
  6. The admin bar stops working, since JS crashed

Actual behavior

The dropbutton JS library is still loaded, despite the fact that the Manage taxonomies block is not rendered. The second bug I mentioned above is triggered. Because JS crashes, the admin bar stops working.

Expected behavior

Backdrop should not load unnecessary libraries - in this case, since the Manage taxonomies block is not rendered, the dropbutton library should not be loaded.

Additional information

  • Backdrop CMS version: 1.26.1
  • PHP version: 8.1
  • Browser(s) and their versions: Chrome, latest. Firefox, lates.
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