-
-
Notifications
You must be signed in to change notification settings - Fork 254
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
feat(SelectItem): Emit a select event when an option is selected #1513
base: v2
Are you sure you want to change the base?
Conversation
commit: |
I see there's a failing check. But it doesn't seem to be caused by my changes as I didn't touch that part of the code. |
Yoo @kilobyte2007 ! I've fixed the test issue, can you please rebase the branch on |
if (ev.defaultPrevented) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't have this conditional here, it will prevent the select
from being emitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is needed because this logic is handling the initial mousedown event, when the dropdown just shows up. Without this check the dropdown just shows up on mousedown and disappears on mouseup.
So basically the check that we had previously - has moved from handleSelect
to handleSelectCustomEvent
, as this is the place now where we handle the original event. And the check that we have now in handleSelect
is for actually preventing the artificially created event.
Let me know if the explanation is clear enough!
…works for Combobox/Listbox with ListboxItem
fd91ce5
to
2922b10
Compare
I've implemented a
select
event/emit on theSelectItem
so it's consistent withListbox/Combobox
.This is especially important when using
multiple
because we cannot rely onupdate:modelValue
as we only need the specific item that was last selected.Let me know if you have any questions or objections!