Problem/Motivation

Two of the request headers used by HTMX use the HTML id property. Since these can be dynamic in Drupal, a data-drupal-selector is provided by core.

Proposed resolution

Add to `htmxDrupalPageState()`

// Swap in drupal data selectors as #id values are altered to be unique.
configRequestEvent.detail.headers['HX-Target'] = configRequestEvent.detail.target.dataset.drupalSelector;
configRequestEvent.detail.headers['HX-Trigger'] = configRequestEvent.detail.elt.dataset.drupalSelector;

Issue fork htmx-3488016

Command icon 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

fathershawn created an issue. See original summary.

  • fathershawn committed 099fe360 on 1.3.x
    Issue #3488016 by fathershawn: Use data-drupal-selector as returned...
fathershawn’s picture

Status: Active » Fixed
fathershawn’s picture

Status: Fixed » Closed (fixed)