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

Click event is fired for "invalid" clicks #12011

Open
feliperuiz opened this issue Apr 12, 2021 · 3 comments
Open

Click event is fired for "invalid" clicks #12011

feliperuiz opened this issue Apr 12, 2021 · 3 comments

Comments

@feliperuiz
Copy link

Version

2.6.11

Reproduction link

https://codepen.io/feliperuiz/pen/MWJQPaR?editors=1011

Steps to reproduce

Reproducing this bug requires:

  • a mouse with a clickable scroll wheel
  • opening the repro link with desktop safari or firefox<68

With that said, steps to reproduce are:

  • click the "click me" text with the primary button of your mouse
  • check the console output
  • click the "click me" text with the middle button of your mouse
  • check the console output

What is expected?

There should be a single entry in the console, for the click performed with the primary button — with text "You clicked something with mouse button 0".

What is actually happening?

There are two entries in the console, one for the click performed with the primary button — with text "You clicked something with mouse button 0" — and another for the middle button — with text "You clicked something with mouse button 1".


The UI events specs state that:

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. See auxclick for a corresponding event that is associated with the non-primary buttons.

Safari, however, does not care about what the specs say and fires the click event for secondary buttons, as evidenced by this bug. Until version 68, Firefox would do the same, as noted in this bug report and the release notes for that version.

I found these two issues [1, 2] on the Vue repo that relate to it, but they're more about normalizing behavior so that @click.middle and @click.right behave more as one would expect them to, rather than normalizing behavior to account for browser quirks that cause @click to behave as one wouldn't expect it to.

@NavaneethVijay
Copy link

@feliperuiz Its working as expected. Can you share more info on OS and browser used to reproduce this issue

@feliperuiz
Copy link
Author

@NavaneethVijay, I'm able to reproduce it in macOS 10.15.7 and Safari version 14.0.3 (15610.4.3.1.7, 15610). As is mentioned in the original description, it only happens on desktop Safari and Firefox < 68, and requires a mouse with a clickable scroll wheel.

@tuananhdo9829

This comment has been minimized.

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

No branches or pull requests

3 participants