Generalize photoswipe button event target #27804
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
This solves a custom theme interoperability issue. I have a theme were the
<a href="#" class="woocommerce-product-gallery__trigger"></a>button has an SVG child element.This causes an issue where clicking the SVG element causes the event target to be the
<svg>not the<a>. Since the event target can only be.woocommerce-product-gallery__triggeror.woocommerce-product-gallery__trigger imgtheifstatement on line 303 fails and the valued ofclickedbecomes the first image in the slider.By ensuring the the event target is (or is a child of)
.woocommerce-product-gallery__triggerwe can let the event propagate up the DOM and still capture it at the.woocommerce-product-gallery__triggerelement and test to ensure the clicked element is a child.How to test the changes in this Pull Request:
Other information:
Changelog entry