aurelia / ux

A user experience framework with higher-level capabilities, designed to bring simplicity and elegance to building cross-device, rich experiences.
MIT License
368 stars 55 forks source link

fix(chip-input): stop propagation on ENTER or ESC #252

Closed ben-girardet closed 4 years ago

ben-girardet commented 4 years ago

I noticed that when using a chip-input inside a drawer we get a undesired behavior. Both are listening for the keyup change on ENTER and ESC keys.

I suggest that when the chip-input detects the ENTER or ESC keyup it stops the propagation so that other handlers don't act on it as well.

@bigopon what do you think ?

bigopon commented 4 years ago

This sounds good to me. Does stopImmediatePropagation work, should it be stopPropagation?

ben-girardet commented 4 years ago

From my understanding both work, stopImmediatePropagation is a little more aggressive in terms of stopping the event.

https://stackoverflow.com/questions/5299740/stoppropagation-vs-stopimmediatepropagation

Note: I have tested with stopImmediatePropagation and it works.

bigopon commented 4 years ago

Sounds good then. I misunderstood the stopImmediatePropagation, thought it was only for the current target.

bigopon commented 4 years ago

@EisenbergEffect pinging you to queue a release

bigopon commented 4 years ago

Thanks @ben-girardet for this PR. I think generally we can stop the (immediate)propagation for the enter key, and probably a few more if needed. It's suitable action for a component lib.