Problem/Motivation

It looks like the spiffy new 'Show usage in old revisions' feature doesn't quite play nice with Claro as the admin theme.
After clicking the checkbox, the operation dropdown buttons no long function as expected
dropdown button not displaying correctly

Steps to reproduce

  • Set your admin theme to Claro
  • Go to a usage tab that includes items that have an operations dropdown
  • Click the Show usage in old revisions' checkbox

Proposed resolution

Comments

jasongose created an issue. See original summary.

shank115’s picture

Status: Active » Needs review

I was able to reproduce this on Drupal 11.4.8 with Entity Usage 5.0.1 and Claro.

This looks like a core bug rather than an Entity Usage one. The checkbox swaps the listing in place using core's HTMX. Claro adds dropbutton-noscript.css inside a <noscript> tag, but core's HTMX asset loader (core/misc/htmx/htmx-assets.js) parses the response with scripting disabled. The <noscript> contents become real elements, so the stylesheet gets loaded on the page. That CSS forces all dropbutton items to be visible, which breaks the dropdowns.

This is already fixed in core main as part of - Update to htmx 4 which removes <noscript> elements from the HTMX response before loading assets. It hasn't been backported to 11.x, so Drupal 11 sites are still affected.

Adding this line to htmx-assets.js on 11.4.8 fixed it for me:
responseHTML.querySelectorAll('noscript').forEach((el) => el.remove());

It probably needs a core issue to backport this to 11.x.

alexpott’s picture

@shank115 great bug report and nice sleuthing. Can you think of a way we can fix this in entity usage on 11.x - htmx 4 is not going to be backported. It might be possible to backport the responseHTML.querySelectorAll('noscript').forEach((el) => el.remove()); but that feels like it is going to take some time too - so maybe a clunky Drupal 11 only fix in this module is best path forward.