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 that doesn't conform to type #276

Open
erezarnon opened this issue Dec 1, 2023 · 2 comments
Open

Change event that doesn't conform to type #276

erezarnon opened this issue Dec 1, 2023 · 2 comments
Labels
discussion Gathering feedback on open questions docs Improvements or additions to documentation good first issue Good for newcomers

Comments

@erezarnon
Copy link

The component forwards change events from its input. Those events don't conform to the change event type definition.

Repro

Steps to reproduce the problem:

  1. Add a change handler that uses e.detail.type, which according the documentation should exist
  2. Click on the multiselect's input field
  3. Type in some characters
  4. Blur
  5. The input's change event gets emitted. e.detail is undefined and you get an error.
@erezarnon erezarnon added the bug Something isn't working label Dec 1, 2023
@janosh
Copy link
Owner

janosh commented Dec 1, 2023

You're confusing two types of change events. The component emits synthetic change events whenever the selected options list changes (i.e. items are added/removed). This one has a event.detail.type payload. It also forwards DOM change events from the input node. This one does not have a event.detail.type payload.

Maybe the docs could be clearer on this point. PRs welcome!

@janosh janosh added docs Improvements or additions to documentation discussion Gathering feedback on open questions good first issue Good for newcomers and removed bug Something isn't working labels Dec 1, 2023
@erezarnon
Copy link
Author

Yup, we had coded based on the docs and every once in a while would get exceptions that didn't make sense. I had to look at the source code to figure out how detail can be undefined, and once that was clear it was easy to reproduce and handle the input change events differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Gathering feedback on open questions docs Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants