Skip to content

fix: preserve target attribute on filterable gallery items#813

Open
amin-abir wants to merge 2 commits into
WPDevelopers:devfrom
amin-abir:81790
Open

fix: preserve target attribute on filterable gallery items#813
amin-abir wants to merge 2 commits into
WPDevelopers:devfrom
amin-abir:81790

Conversation

@amin-abir

Copy link
Copy Markdown

Summary

  • Preserve the target attribute when sanitizing anchor markup in the Filterable Gallery widget, so links configured to open in a new tab continue to do so after sanitization.

Test Plan

  • Add a Filterable Gallery widget on http://localhost:8888
  • Configure a gallery item link with "Open in new window"
  • Verify the rendered <a> tag retains target="_blank" (and rel if set)
  • Click the item — confirm it opens in a new tab on the frontend
  • Re-test with no target set — link should open in same tab

Breaking Changes

None.

Pro Repo Coordination

None — change is isolated to Lite's filterable-gallery view script.

Related

amin-abir and others added 2 commits May 19, 2026 16:55
DOMPurify was stripping the target attribute from anchor tags, breaking
"open in new tab" behavior for gallery links. Allow target via ADD_ATTR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant