-
Notifications
You must be signed in to change notification settings - Fork 906
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
md-filter-chip: remove event and its usability #5118
Comments
I think it's the same problem as #4951 before. We could remove the chip right on the click event, and revert it if the user explicitly used So I agree having a custom event e.g. A temporary solution you may be aware of is waiting the update to complete, async #onChipRemoved() {
await Promise.all(this.chipset.chips.map(c => c.updateComplete));
// Changes are now reflected
// ...
} But I understand your concern. |
I think this makes sense, but we probably won't introduce it until we add chip removal animations. The chip set is supposed to listen to the |
@asyncLiz that's great. When you design and implement it please consider how you will dispatch it from the chip set (I assume you won't give individual chip event anymore) so we still have information of which chip is getting removed (are you providing the info through a |
Description
Hi, first of all, thanks a lot for fixing #4951 . During the last few days I have been upgrading my client websites' with the new material components and today I stumpled upon this scenario with
<md-filter-chip>
(and<md-input-chip>
as well).Right now the documentation does not mention any event at all which is not really helpful if you want to know when a chip get removed. I see it can be fixed with additional annotation:
However, another issue is when
remove
is fired, the actual chip is not removed yet. This causes very awkward code when handling the event where you have to consider that possibility, for example, when getting values from the children, you have to keep a reference to the chip that is being removed:I understand you should not remove it yet because the user can cancel it using
preventDefault
. My suggestion is to give us another event, likeremoved
so we can simply handle it if we don't care about cancelling:P.s. I know it's discussed before but I still wish the events bubble, or at least re-dispatched by the
<md-chip-set>
so I don't have to add event handlers to each<md-...-chip>
😅Browser/OS Environment
No response
The text was updated successfully, but these errors were encountered: