Skip to content

Conversation

@danielmorell
Copy link
Contributor

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__trigger or .woocommerce-product-gallery__trigger img the if statement on line 303 fails and the valued of clicked becomes the first image in the slider.

By ensuring the the event target is (or is a child of) .woocommerce-product-gallery__trigger we can let the event propagate up the DOM and still capture it at the .woocommerce-product-gallery__trigger element and test to ensure the clicked element is a child.

How to test the changes in this Pull Request:

  1. Create a product with multiple images in the gallery.
  2. Click the image open photoswipe modal button.
  3. Ensure the image in the modal is the currently active image.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable? N/A
  • Have you successfully run tests with your changes locally?

Changelog entry

Allow custom open photoswipe button inner HTML by generalizing the photoswipe button event target

@danielmorell
Copy link
Contributor Author

This PR has been open for 42 days with zero activity.

Base automatically changed from master to trunk February 25, 2021 22:17
@ObliviousHarmony ObliviousHarmony added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Feb 21, 2022
@jorgeatorres jorgeatorres self-requested a review June 14, 2022 12:48
Copy link
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @danielmorell!

Thanks for your contribution 💯. First of all, let me apologize for the delay in responding here.
Your suggestion makes perfect sense and I'd be happy to merge the fix.

In order to not delay things even more, I took the liberty of rebasing your changes to match the latest trunk and adding a changelog entry (which is now required as part of the review process), as well as one tiny tweak to the code.

Thanks again! 🙇‍♂️

@jorgeatorres jorgeatorres merged commit 143d864 into woocommerce:trunk Jun 14, 2022
@github-actions github-actions bot added this to the 6.7.0 milestone Jun 14, 2022
@github-actions
Copy link
Contributor

Hi @jorgeatorres, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants