Add AnimationBlocker to prevent autoplay of GIFs and other potentially animated filetypes#16497
Add AnimationBlocker to prevent autoplay of GIFs and other potentially animated filetypes#16497brandonkelly merged 39 commits into5.7from
Conversation
…ous PR to see if it still works
|
@brandonkelly the user preference has been removed. 👍🏼 |
There was a problem hiding this comment.
@gcamacho079 Looking good! Just a few comments and I pushed up a few minor styling tweaks.
The biggest thing I noticed is that the animated images will play the first time they're inserted into the dom after you upload it (here's a quick video https://share.cleanshot.com/qXWpkXNh).
I think that's because when those are inserted into the DOM, they get an action URL that doesn't have .gif or .webp in the src or srcset. I'm not sure what the best way around it is. The only thing I can think of would be to output some kind of data-filename on the img so we can use that to determine if we should stop the animation.
I suppose another option would be to refactor this into a web component like Shoelace has. Then we could use PHP to determine if an image is animated or not and either output a <craft-animated-image/> wrapper or not. I'm not sure how involved that change would be though. It could be larger than we want it to be.
@brianjhanson thank you for catching that, and for your style updates. 👍🏼 I'll poke around and see what route makes sense. We could also do a hybrid approach of wrapping the image in a web component during the AnimationBlocker initialization. |
…mated; also resolves issue of blocker not working when there are no public URLs
brianjhanson
left a comment
There was a problem hiding this comment.
Just one minor "take it or leave it" note. Otherwise, looks good!
|
@brianjhanson all done! 👍🏼 Thanks for the review! |
|
Nice work! |
Description
.webpimages, which could be animated.Related issues
Resolves PT-25