lottie-player icon indicating copy to clipboard operation
lottie-player copied to clipboard

Lottie player tag not showing in walker menu with src set

Open Vario opened this issue 3 years ago • 1 comments

Hello, we have a problem, showing animations with lottie player in a walker menu. The issue is, that the lottie player tag disappears, when it is used in a walker menu and the src property is set. If the src property is empty, the tag is showing up, but obviously nothing can be played.

code with src set and player tag missing

if( get_field('icon_anim', $item) == true ){
if( $menu_anim = get_field('menu_anim', $item) ):
$item_output .= '<lottie-player src="'.$menu_anim['url'].'" background="transparent" speed="1" loop autoplay></lottie-player>';
endif;
} else {
if( $icon = get_field('icon', $item) ):
$item_output .= '<span class="img-gif"><img class="gif" src="'.$icon['url'].'" alt="image description"/></span>';
endif;
}

Code with empty src and player tag showing

if( get_field('icon_anim', $item) == true ){
if( $menu_anim = get_field('menu_anim', $item) ):
$item_output .= '<lottie-player src="" background="transparent" speed="1" loop autoplay></lottie-player>';
endif;
} else {
if( $icon = get_field('icon', $item) ):
$item_output .= '<span class="img-gif"><img class="gif" src="'.$icon['url'].'" alt="image description"/></span>';
endif;
}

I have already postet the question on stackoverflow, so I will post the link to it where you can see the results of the generated html code https://stackoverflow.com/questions/70923666/lottie-player-tag-in-walker-submenu-not-showing

Basically lottie-player is working on the site, if not used in the walker menu. There are no errors/warnings in the console either.

It would be great to find out how this is happening. Thank you

Vario avatar Feb 08 '22 15:02 Vario

@Vario This is very hard for us to debug without a workable example, if you can re-create the bug on codesandbox that would be a great help!

samuelOsborne avatar Apr 28 '22 08:04 samuelOsborne