Vue: add .none modifier to keyboard

Created on 26 Jun 2017  ·  8Comments  ·  Source: vuejs/vue

What problem does this feature solve?

Using the modifiers is greate (.ctrl, .alt, .meta, .shift).
But there is no modifier indicating that ONLY that key was pressed (without ctrl, alt, shift or meta simultaneously.

What does the proposed API look like?

@keydown.space.none="myEventWhenEnterIsPressedAlone()"
@keydown.space="myEventWhenEnterIsPressedWithOrWithoutAnyModifier()"

feature request in review

Most helpful comment

@truefusion, actually the way it's implemented in #5977 already solves that.

All 8 comments

Hmm, that sounds like a good idea but the none naming is not really intuitive, what do you think about .plain?

Tried a POC, works, opened a PR but I think we need to discuss naming anyway.

I like plain more as well. I think it's a useful feature 🙂

Also agree simple but very valid use cases

Ah, I was just about to request the exact same thing for almost the exact same reason! I would like to add that this be extended for mouse clicks, too!

click.left.none
click.none

@truefusion, what is expected behaviour for mouse clicks?

@nickmessing That any click event with the ".plain" event modifier will trigger if and only if no key modifier is held down. This would leave the default click event available for complex cases and would not conflict with ".left", ".middle" and ".right" when combined.

@truefusion, actually the way it's implemented in #5977 already solves that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisvfritz picture chrisvfritz  ·  46Comments

karevn picture karevn  ·  42Comments

ecmel picture ecmel  ·  52Comments

yyx990803 picture yyx990803  ·  210Comments

okjesse picture okjesse  ·  49Comments