airbnb / lottie-web

Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/
MIT License
30.42k stars 2.86k forks source link

Missing attributs height + width on <image> tag #2980

Open Vannsl opened 1 year ago

Vannsl commented 1 year ago

Tell us about your environment

What did you do? Please explain the steps you took before you encountered the problem.

What did you expect to happen?

What actually happened? Please include as much relevant detail as possible.


When running the HTML rendered by the vue3-lottie component, which uses lottie-web, W3C shows the following errors:

Error: Element image is missing required attribute height.
Error: Element image is missing required attribute width.

on the first <image> tag within the HTML_

<div data-id="6hgoyK4maBR4WOsJGNLF" class="lottie-animation-container" aria-hidden="true" style="--lottie-animation-container-width: 20px; --lottie-animation-container-height: 20px; --lottie-animation-container-background-color: transparent;"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 277 272" width="277" height="272" preserveAspectRatio="xMidYMid meet" style="width: 100%; height: 100%; transform: translate3d(0px, 0px, 0px); content-visibility: visible;"><defs><clipPath id="__lottie_element_2"><rect width="277" height="272" x="0" y="0"></rect></clipPath><image xlink:href="data:image/png;base64, ...
bodymovin commented 1 year ago

hi, image elements by default add their width and height. Do you have an example of an animation with this issue?

Vannsl commented 1 year ago

Hi @bodymovin,

thank you for checking. Here's the JSON: https://gitlab.com/-/snippets/2547837