Skip to content

Interactivity API: Fix context inheritance from namespaces different than the current one#64677

Merged
luisherranz merged 3 commits into
trunkfrom
fix/iapi-context-inheritance
Aug 21, 2024
Merged

Interactivity API: Fix context inheritance from namespaces different than the current one#64677
luisherranz merged 3 commits into
trunkfrom
fix/iapi-context-inheritance

Conversation

@DAreRodz

Copy link
Copy Markdown
Contributor

What?

Fixes a bug introduced in the recent refactoring of the Interactivity API internals (see #62734). Noticed while merging trunk in #62906.

Why?

The data-wp-context directive stopped propagating values from parent contexts using a different namespace. This broke directives trying to access values from such contexts.

Testing Instructions

These changes can be tested on top of the #62906 PR.

To reproduce the issue:

  1. Checkout Gallery: Add lightbox support #62906 locally.
  2. Merge trunk in the current branch.
  3. Create a gallery on your test site with a couple of images.
  4. Select "Expand on click" for each image.
  5. Visit the page with the gallery.
  6. When you expand an image, the buttons to navigate to the next and previous images don't appear.

To check the issue is fixed:

  1. Checkout Gallery: Add lightbox support #62906 locally.
  2. Merge this PR's branch in the current branch.
  3. Follow steps 3 to 5 from the list above.
  4. When you expand an image, the buttons to navigate to the next and previous images should appear.

@DAreRodz DAreRodz added [Type] Bug An existing feature does not function as intended [Feature] Interactivity API API to add frontend interactivity to blocks. [Package] Interactivity /packages/interactivity labels Aug 21, 2024
@DAreRodz DAreRodz self-assigned this Aug 21, 2024
@DAreRodz DAreRodz changed the title Fix/iapi context inheritance Interactivity API: Fix context inheritance from different namespaces than the current one Aug 21, 2024
@DAreRodz DAreRodz changed the title Interactivity API: Fix context inheritance from different namespaces than the current one Interactivity API: Fix context inheritance from namespaces different than the current one Aug 21, 2024
@DAreRodz DAreRodz marked this pull request as ready for review August 21, 2024 09:45
@github-actions

github-actions Bot commented Aug 21, 2024

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: DAreRodz <darerodz@git.wordpress.org>
Co-authored-by: luisherranz <luisherranz@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@luisherranz luisherranz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thanks for the fix David.

@luisherranz luisherranz enabled auto-merge (squash) August 21, 2024 10:10
@luisherranz luisherranz merged commit 5fb9c1c into trunk Aug 21, 2024
@luisherranz luisherranz deleted the fix/iapi-context-inheritance branch August 21, 2024 10:20
@github-actions github-actions Bot added this to the Gutenberg 19.1 milestone Aug 21, 2024
samueljseay pushed a commit to woocommerce/woocommerce that referenced this pull request Aug 21, 2024
bph pushed a commit to bph/gutenberg that referenced this pull request Aug 31, 2024
…than the current one (WordPress#64677)

* Add failing test

* Fix contextStack generation to include other namespaces

* Update changelog

Co-authored-by: DAreRodz <darerodz@git.wordpress.org>
Co-authored-by: luisherranz <luisherranz@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Interactivity API API to add frontend interactivity to blocks. [Package] Interactivity /packages/interactivity [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants