shoelace-style / shoelace

A collection of professionally designed, every day UI components built on Web standards. SHOELACE IS BECOMING WEB AWESOME πŸ‘‡πŸ‘‡πŸ‘‡
https://webawesome.com
MIT License
12.76k stars 816 forks source link

Combining dropdown, menu and triggering a drawer causes a weird show animation #2052

Open nomve opened 4 months ago

nomve commented 4 months ago

Describe the bug

Drawer exhibits an unusual animation when triggered from an element inside Dropdown.

To Reproduce

Steps to reproduce the behavior:

  1. create a structure similar to this (there's also a link to the demo with the exact setup)
    <sl-dropdown>
    <sl-menu>
    <sl-menu-item></sl-menu-item>
    </sl-menu>
    </sl-dropdown>
  2. have the menu-item open an <sl-drawer>
  3. observe the drawer open animation
  4. it will open with a strange bounce

Demo

https://codepen.io/nomve-the-encoder/pen/LYoLoOb

Browser / OS

Additional information

nomve commented 4 months ago

My guess is it's something with the animations of both elements, so I was able to "fix" it by stopping the click event from bubbling from the menu-item. It works for me in this case, but it's not ideal in general. But anyway, hope it helps someone.

KonnorRogers commented 3 months ago

A setTimeout on the panel.show() also works too...curious... πŸ€”

nomve commented 3 months ago

A setTimeout on the panel.show() also works too...curious... πŸ€”

that's a better fix, thanks. My workaround prevents the menu from getting closed when clicked.

claviska commented 3 months ago

@KonnorRogers this doesn't happen in Web Awesome. It's likely related to the JS animation stuff, which I reworked to use CSS animations in 3.0.

We'll welcome a PR if anyone has the time to investigate it further, but just know that this bug has been fixed in the next major.