Skip to content

Conversation

@girishpanchal30
Copy link
Contributor

Closes #2736

Summary

Re-animated the image or gallery block when WP Enlarge is open.

Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@pirate-bot
Copy link
Contributor

pirate-bot commented Feb 9, 2026

Bundle Size Diff

Package Old Size New Size Diff
Animations 271.38 KB 271.64 KB 267 B (0.10%)
Blocks 1.54 MB 1.54 MB 0 B (0.00%)
CSS 100.76 KB 100.76 KB 0 B (0.00%)
Dashboard 198.36 KB 198.36 KB 0 B (0.00%)
Onboarding 160.8 KB 160.8 KB 0 B (0.00%)
Export Import 97.73 KB 97.73 KB 0 B (0.00%)
Pro 407.08 KB 407.08 KB 0 B (0.00%)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the animations frontend runtime to re-trigger Otter animations when a WordPress “Enlarge on click” lightbox is opened, addressing a compatibility issue where animated images/galleries can appear invisible in the lightbox.

Changes:

  • Adds a lightbox container click listener to re-run animateElements() when the WP lightbox is interacted with.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 406 to 411
const lightboxes = document.querySelectorAll('.wp-lightbox-container');
lightboxes.forEach((container) => {
container.addEventListener('click', () => {
animateElements();
});
});
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Formatting in this new block doesn’t match the surrounding file’s spacing conventions (e.g., window.addEventListener( 'load', … )). Please align with the existing style (spaces inside parentheses, consistent indentation) to keep the file consistent.

Copilot uses AI. Check for mistakes.
Comment on lines 405 to 410
// Re-animate elements when a lightbox is opened, as the content might be different.
const lightboxes = document.querySelectorAll('.wp-lightbox-container');
lightboxes.forEach((container) => {
container.addEventListener('click', () => {
animateElements();
});
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

This change adds/changes frontend behavior for animations when the WordPress lightbox opens, but there’s no automated coverage to prevent regressions. Since the repo already has Playwright E2E coverage for animations, please add an E2E that applies an Otter animation to a core Image/Gallery block with “Enlarge on click” enabled and asserts the media is visible when the lightbox opens (and ideally after closing/reopening).

Copilot uses AI. Check for mistakes.
@pirate-bot
Copy link
Contributor

pirate-bot commented Feb 9, 2026

Plugin build for f0e644e is ready 🛎️!

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

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WP Enlarge on click option not working anymore when using Otter's animations

2 participants