Vue: mouse modifier @click.right not working

Created on 30 Mar 2017  ·  11Comments  ·  Source: vuejs/vue

Version

2.2.1

Reproduction link

https://jsfiddle.net/nosferatu79/z1jhpewo/

Steps to reproduce

click on the textarea with the right click of your mouse

What is expected?

it should add in the textarea the following text:

contextmenu
right

What is actually happening?

there is only the text:

contextmenu

bug

Most helpful comment

Hmm maybe click.right should be aliased into contextmenu at compile time?

All 11 comments

Sorry, I'll try with a version >2.2.1,

Thank you

sorry, but in this updated version it doesn't work either:
https://jsfiddle.net/z1jhpewo/1/

@stefanonepa
sorry it's my fault

@stefanonepa
maybe u need mousedown event
https://javascript.info/mouse-events-basics

@Kingwl I'm not sure that this documentation is very reliable, because in the explanation here: https://javascript.info/mouse-events-basics#complex-events , it says that contextmenu is fired on mousedown (and in the example it didn't write contextmenu if you just mousdown the right button)...

In the other way it says that a click event is fired when mousedown is followed by by a mouseup... So it seems that

@click.right

should works, you do not agree?

@stefanonepa
https://www.w3.org/TR/uievents/#event-type-click

The click event should only be fired for the primary pointer button (i.e., when button value is 0, buttons value is 1). Secondary buttons (like the middle or right button on a standard mouse) MUST NOT fire click events. The click event MAY be preceded by the mousedown and mouseup events on the same element, disregarding changes between other node types (e.g., text nodes). Depending upon the environment configuration, the click event MAY be dispatched if one or more of the event types mouseover, mousemove, and mouseout occur between the press and release of the pointing device button. The click event MAY also be followed by the dblclick event.

@Kingwl thank you for the standard (even it's a bit foggy for me)

But how should I interpret or use the .right of the "mouse button modifiers" (cf. https://vuejs.org/v2/guide/events.html#Mouse-Button-Modifiers)? Because with the @click.middle it fire a click event... Maybe I should suggest to add some info in the official documentation?

Hmm maybe click.right should be aliased into contextmenu at compile time?

It would be a great!

Thank you @yyx990803 !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hiendv picture hiendv  ·  3Comments

bdedardel picture bdedardel  ·  3Comments

franciscolourenco picture franciscolourenco  ·  3Comments

robertleeplummerjr picture robertleeplummerjr  ·  3Comments

bfis picture bfis  ·  3Comments