googlearchive / core-input

A single-line text field with some extra powers
7 stars 20 forks source link

Unable to distinguish between a blur and enter #8

Closed ghost closed 9 years ago

ghost commented 10 years ago

There needs to be a way to distinguish between these two events so that enter can trigger a custom action.

morethanreal commented 10 years ago

Is there an issue that cannot be addressed by having the user install a change and blur event handler on the core-input? I am reluctant to bake this into core-input.

ghost commented 10 years ago

core-input seems too opinionated in its functionality for me and this leads to a huge restriction in functionality. blur and enter are not the same thing. For instance, I have a UI where I'm using a core-input to tack on elements to a list. When the user hits enter, I want to add a new element to this list. When they just tab away, nothing should happen. I can't figure out a "good" way to handle this, so I ended up adding an event listener on to core-input::shadow #input<keyup> which is extremely hacky.

If you proxied the keyboard events, I'd be perfectly happy with that, but as it is core-input is significantly more restrictive than a normal <input>

morethanreal commented 10 years ago

The input events should bubble. Do you mean something like this? http://jsbin.com/xobuz/1/edit

morethanreal commented 9 years ago

core-input now extends from input.