Problem/Motivation
Core's htmx:beforeSwap handler in core/misc/htmx/htmx-assets.js drops the promise of the assets a response brings, so htmx:drupal:load fires before those scripts have run.
The behaviors they define never attach to the form that brought them: core's autocomplete, and the ui_icons autocomplete and grid trigger, stay inert until a later form loads.
The component's core/drupal.ajax dependency works around the same bug, for #ajax only.
Found with ui_icons, see #3591899: Add automated functional acceptance testing for Webshare with webship-js (Playwright + Cucumber-js), Drupal Canvas + Drupal CMS support, and MkDocs documentation
Steps to reproduce
1. Enable ui_icons_patterns and open a page layout builder.
2. Insert the "Icon" block and type an icon name in its Config tab. No suggestions show.
3. Select another element, then the Icon block again. Suggestions now show.
Proposed resolution
Wrap Drupal.htmx.addAssets() and attach behaviors on the side panels once its promise resolves, with a @todo to remove it once core waits for the assets.
Issue fork display_builder-3631446
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
mogtofu33 commentedComment #6
pdureau commented