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

Change event on select is fired right after creation #458

Closed
davidkudera opened this issue Jun 4, 2021 · 3 comments
Closed

Change event on select is fired right after creation #458

davidkudera opened this issue Jun 4, 2021 · 3 comments
Assignees
Labels
bug Things that aren't working right in the library.

Comments

@davidkudera
Copy link

Describe the bug
sl-change event on <sl-select> is fired right after it was created. This behavior is different from the native <select> change event which is fired only after a user chooses a new value. When using <sl-select multiple> the sl-change event is fired two times on init.

To Reproduce
I prepared example in Lit playground: example

Expected behavior
sl-change event on <sl-select> should not be dispatched on init (not once, not twice).

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser chrome
  • Version 91.0.4472.77
@davidkudera davidkudera added the bug Things that aren't working right in the library. label Jun 4, 2021
@claviska
Copy link
Member

claviska commented Jun 4, 2021

Thanks for reporting this. Since select doesn't map to an actual form control, the sl-change event is simulated and was firing prematurely during init. This fix will be in beta.44.

@davidkudera
Copy link
Author

Wow, you're fast. Thank you 🍻

@claviska
Copy link
Member

Shoelace v2.0.0-beta.44 has been released

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.
Projects
None yet
Development

No branches or pull requests

2 participants