Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nomve opened this issue Jun 7, 2024 · 4 comments
Labels
bug Things that aren't working right in the library.

Comments

@nomve
Copy link

nomve commented Jun 7, 2024

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>
  1. have the menu-item open an <sl-drawer>
  2. observe the drawer open animation
  3. it will open with a strange bounce

Demo

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

Browser / OS

  • my guess all browsers and OS
  • reproduced on Chrome+Safari (macos) and iOS

Additional information

  • Safari is especially bad
  • it will not reproduce if the drawer placement is something other than "end" (e.g. "start")
  • weirdly it does not happen always in my code base, but I was not able to figure out why because the same components sometimes trigger it and sometimes not. The one where it happened for me was a drawer that had the dropdown inside of it that again opened a new drawer. I was surprised I could reproduce it with the simple case on codepen
  • I could also reproduce it with some weird combinations of elements (not that I would expect it to work normally), like: dropdown with two triggers and the second one directly opening the drawer
@nomve nomve added the bug Things that aren't working right in the library. label Jun 7, 2024
@nomve
Copy link
Author

nomve commented Jun 7, 2024

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
Copy link
Collaborator

A setTimeout on the panel.show() also works too...curious... 🤔

@nomve
Copy link
Author

nomve commented Jun 10, 2024

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
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
3 participants