-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Fixes #1218 - change triggered on blur #1251
Fixes #1218 - change triggered on blur #1251
Conversation
Currently docs say that the "change" event emits String value, after merging this PR "change" event will emit String or Number (Number if v-model has "number" modifier), so I guess the docs should be updated as well |
I had already fixed this issue, forgot to push. Thank you for your contribution however. |
@johnleider - it doesn't seem to be fixed for me. Try to use this Playground.vue I've provided, it still sometimes emits 2 events:
|
Well I haven't released it yet
…On Aug 4, 2017 5:17 PM, "Jacek Karczmarczyk" ***@***.***> wrote:
@johnleider <https://github.com/johnleider> - it doesn't seem to be fixed
for me. Try to use this Playground.vue I've provided, it still sometimes
emits 2 events:
- type "abc " (with spaces at the end)
- blur - 2 events are emitted (one with event object, one with input
value)
- focus again and blur - event is still emitted although value hasn't
changed
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1251 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIpOgkZ-kr918Bg1q5wSPTBj9QQANMreks5sU4p_gaJpZM4OuJfE>
.
|
Also blur and change are expected, no?
…On Aug 4, 2017 5:32 PM, "John Leider" ***@***.***> wrote:
Well I haven't released it yet
On Aug 4, 2017 5:17 PM, "Jacek Karczmarczyk" ***@***.***>
wrote:
> @johnleider <https://github.com/johnleider> - it doesn't seem to be
> fixed for me. Try to use this Playground.vue I've provided, it still
> sometimes emits 2 events:
>
> - type "abc " (with spaces at the end)
> - blur - 2 events are emitted (one with event object, one with input
> value)
> - focus again and blur - event is still emitted although value hasn't
> changed
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#1251 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AIpOgkZ-kr918Bg1q5wSPTBj9QQANMreks5sU4p_gaJpZM4OuJfE>
> .
>
|
To be precise - when I wrote "2 events are emitted" I meant "2 'change' events are emmited", I guest the 'blue' event also was emitted but I didn't check it And in the last step I've also checked only 'change' event. It was emitted, but I'd expect only blur event if the value has not changed My change also takes into account the "trim" or "number" modifier as I wrote before, so "a " and "a" values are equals (after trimming) so "change" event imho shouldn't be emitted |
Can you go on chat tonight? I'd like to discuss more there.
Https://chat.vuetifyjs.com
…On Aug 4, 2017 5:45 PM, "Jacek Karczmarczyk" ***@***.***> wrote:
To be precise - when I wrote "2 events are emitted" I meant "2 'change'
events are emmited", I guest the 'blue' event also was emitted but I didn't
check it
And in the last step I've also checked only 'change' event. It was
emitted, but I'd expect only blur event if the value has not changed
My change also takes into account the "trim" or "number" modifier as I
wrote before, so "a " and "a" values are equals (after trimming) so
"change" event imho shouldn't be emitted
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1251 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIpOgrDg3JH-ClMaApG5C97K_T0CyLvEks5sU5DrgaJpZM4OuJfE>
.
|
First commit removes emitting 'change' event on blur. Now the 'change' event is emitted only when input.value changes. However it emits the event object instead of input value (as it should do according to documentation). It also emits event when value after applying modifiers has not changed - i.e. when trailing spaces were added to the value of the text field with "trim" modifier. Input element fires the 'change' event, but the effective value (input.value.trim()) doesn't change
Second commit fixes the last issue, and the 3rd commit fixes the emitted value (input value instead of event object)
Playground.vue for testing: