Vuetify: [Bug Report] Enter key doesn't trigger @change event on v-text-field

Created on 10 Jan 2018  路  5Comments  路  Source: vuetifyjs/vuetify

Versions and Environment

Vuetify: 0.17.6
Vue: 2.5.13
Browsers: Chrome 63.0.3239.132
OS: Mac OS 10.13.1

Steps to reproduce

  1. Enter value into v-text-field
  2. Hit enter key
  3. Note that there is no console output, as the change event doesn't fire
  4. Blur the input
  5. Note that there is console output, as the change event does fires

Expected Behavior

Given I've entered text into a v-text-field and the underlying value has changed
When I press enter
I expect the change event to fire

Actual Behavior

The enter key does not trigger the change event.

Reproduction Link

https://codepen.io/johnjleider/pen/ypKvMJ?editors=1111

Other comments

As discussed on Discord, the surface area of this change could be quite big.

critical

Most helpful comment

Ok, managed to get it to work with @input.native.

All 5 comments

I don't expect the change event to fire on enter. Why should it?

@smares My rationale (and what prompted me to pose the initial question) was that native inputs behave this way. After you've typed something new, hitting enter triggers the change event.

https://codepen.io/mattrothenberg/pen/goeeGM/

Hmm, indeed. HTML4 specs say "The onchange event occurs when a control loses the input focus and its value has been modified since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and TEXTAREA." WHATWG however says "The change event fires when the value is committed, if that makes sense for the control, or else when the control loses focus.". Not sure if they specify anywhere what "committed" means.

Quite new to vue/vuetify, but I would expect the event to be passed on input change (@input) also. At least this is the behaviour I get if I use a conventional input field. I have been trying for the last hour or so but I cannot seem to get to pass the whole event to a method on input. I know Matt above highlighted for @change, but the same issue applies to @input.

Ok, managed to get it to work with @input.native.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paladin2005 picture paladin2005  路  3Comments

cawa-93 picture cawa-93  路  3Comments

milleraa picture milleraa  路  3Comments

chriswa picture chriswa  路  3Comments

gluons picture gluons  路  3Comments