Skip to content
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

Native event and VueJs Event modifier #6900

Closed
kl3sk opened this issue Oct 24, 2017 · 1 comment
Closed

Native event and VueJs Event modifier #6900

kl3sk opened this issue Oct 24, 2017 · 1 comment

Comments

@kl3sk
Copy link

kl3sk commented Oct 24, 2017

Version

2.5.2

Reproduction link

https://jsfiddle.net/klesk/0x4q5kup/1/

Steps to reproduce

A/ Press enter in the input

B/ Check the checkbox (that emultae keyboard event)

What is expected?

A/ the classList should appear

B/ the classList should appear

What is actually happening?

A/ the classList of it appear

B/ nothing appear


Remove the modifier in the template (eg: @keyup) and the checkbox raise event.

Is that normal? Or a bug ?

@yyx990803
Copy link
Member

yyx990803 commented Oct 24, 2017

enter is a built-in alias so Vue is checking for $event.keyCode == 13. So you should pass { keyCode: 13 } to the event constructor.

However, Chrome ignores the keyCode option (seems to be a bug, although keyCode is technically deprecated). For now you might have to simulate the event using the old fashioned way (document.createrEvent + initEvent).

If you want to pass the key it should be { key: 'Enter' }. We should probably make that supported somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants