Loading
fix: #3631091 Add the HTMX copy handler to the Copy link in the social media menu template
Issue: https://www.drupal.org/i/3631091
menu--social-media-menu.html.twigaddshx-on:click(copy the page address, addis-copied, announce "Link copied") andhx-on:keydown(Space) to a link with thecopy-linkclass. It attaches core'score/drupal.htmxonly then. Core 11.4.10 ships htmx 2.0.x, not HTMX 4.- The nav-menu SDC gains an optional per-item
link_attributes, merged into the link. nav-menu isnoUi, so no Canvas component version changes. - Why the template: core 11.4.10's
AttributeXssstripshx-*from menu link content, as htmx's own security advice says to do for user content. The same change is in Vartheme BS5 Rightup (vartheme_bs5_rightup!68 (merged)). - README:
hx-onuses eval, so a site with a strict Content Security Policy needs'unsafe-eval'inscript-src.
Nothing changes visually until a Social media menu link has the copy-link class. Varbase Starter adds one in https://www.drupal.org/i/3631092.
Checked on a Varbase Starter site with a temporary Copy link item, headless at 1440 and 390: click, Enter and Space each copy the URL and stay on the page, with no console errors.
Merge order: merge this MR first and let the dev release repackage. Then merge the Varbase Starter MR for https://www.drupal.org/i/3631092, whose footer test checks this handler.
AI-Generated: Yes
Checkpoints:
- File an issue
- Addition/Change/Update/Fix
- Testing to ensure no regression
- Automated unit testing coverage
- Automated functional testing coverage
- UX/UI designer responsibilities
- Readability
- Accessibility
- Performance
- Security
- Developer Documentation
- User Guide Documentation
- Reviewed by human
- Code review by maintainers
- Full testing and approval
- Credit contributors
- Review with the product owner
- Release notes snippet
- Release
Edited by Rajab Natshah