Loading
fix: #3631079 Add the HTMX copy handler to the Copy link in the social media menu template
Issue: https://www.drupal.org/i/3631079
- The Copy link uses core's HTMX (
core/drupal.htmx, htmx 2.0.x in core 11.4.10; core ships no HTMX 4). menu--social-media-menu.html.twigaddshx-on:click(copy the page address, addis-copied, announce "Link copied") andhx-on:keydown(Space) to the item whose link has thecopy-linkclass. The message is translatable with|t.- The nav-menu SDC gains an optional
link_attributesper item, merged into the link through Twiglink(). It is generic and reusable, and nav-menu isnoUi, so no Canvas component version changes. - Why the template: core 11.4.10's
AttributeXssstripshx-*andon*from menu link content, as htmx's own security advice says to do for user content. Sohx-onlives only in theme markup, keyed on a class. - The custom
js/copy-link.jsand its library from the first commit are removed. - README:
hx-onuses eval, so a site with a strict Content Security Policy needs'unsafe-eval'inscript-src.
Checked headless at 1440 and 390 on core 11.4.10. Click, Enter and Space each copy the URL and stay on the page, with no console errors. 01-06-front-end-pages.feature passes: 28 scenarios.
Merge order: merge this MR first and let the 1.0.x-dev theme repackage. Then merge rightup!85 (merged), whose footer test checks this handler, then rebase rightup !84. For The Rightup 1.0.6: release this theme first, then raise !83's theme pin to ~1.0.6.
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