question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

If original image has a transition, zoom becomes uncloseable

See original GitHub issue

Bug description

If the image used for the zoom has a transition applied in its style attribute, the zoom will happen (but without animating the transform of the zoom image) but will be uncloseable since medium-zoom never sets isAnimating = false.

This is because medium-zoom listens for the transitionend event, with no fallback. Since the target element is copied to create the zoom image, the style attribute is copied too - and this is never overwritten (the transition defined by medium-zoom is done so in a stylesheet, and is therefore overwritten by the style). Since this means that there’s no transition: transform, the transition never starts or ends, and no transitionend event is emitted.

How to reproduce

  1. Create an image with style="transition: opacity 0.5s" or similar
  2. Run medium-zoom(...) on your image
  3. Click the image - the zoom will open instantly and become uncloseable

Expected behavior

It works even if image has a transition set in its style.

Reproducible example

Link to the bug reproduction

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
madeleineostojacommented, Dec 4, 2019

I’m also seeing this, in my case with a 3rd party library (gatsby-image) where I have no control over the transitions defined. Either one of the patches mentioned by @birjolaxew would be great, even as opt-in behaviour

1reaction
birjjcommented, Aug 1, 2019

@francoischalifour There are generally two ways to fix this: you can either add !important to the transition you define in your stylesheet (in which case it still breaks if the user adds a transition: ... !important, but y’know, that’s pretty edge case), or you can explicitly set the transition on the cloned element e.g. active.zoomed.style.transition = "transform 300ms cubic-bezier(0.2, 0, 0.2, 1)";

Neither should add much complexity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS transition effect makes image blurry / moves image 1px ...
I'm on Chrome 27 on OSX, and it's fine. I believe that when the content gets put into a layer it gets turned...
Read more >
Zooming Methods - Tutorialspoint
The above image has two rows and two columns, we will first zoom it row wise. Row wise zooming: When we zoom it...
Read more >
TVPaint Animation 11 changelogs (latest update 2022_12_07)
Image marks are now undoable. An option has been added to remove loaded soundtrack history. You can now merge two layers when right...
Read more >
2020-Minolta_MN67Z_User-Manual.pdf - Squarespace
This manual provides you with instructions on how to use your new MINOLTA MN67Z. Digital Camera. Every effort has been made to ensure...
Read more >
Animation Composite | Unreal Engine 4.27 Documentation
Animation Composites can also have their own sets of Notifies and Curves. ... of this AnimSequence if played back with a speed of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found