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

Ambiguity of the value of the button property for the click event #513

Open
rr-codes opened this issue Aug 16, 2024 · 3 comments
Open

Ambiguity of the value of the button property for the click event #513

rr-codes opened this issue Aug 16, 2024 · 3 comments
Assignees

Comments

@rr-codes
Copy link

According to the pointer events spec , a pointer event should have a button value of -1 if "Neither buttons nor touch/pen contact changed since last event".

However, this is inconsistent with the behavior of when the click event was a MouseEvent, where the button property would return 0 (for the primary button).

Additionally, it says

The click event should only be fired for the primary pointer button (i.e., when button value is 0, buttonsvalue is 1)

which further seems to contradict the statement that button should be -1 if it hasn't changed.

@mustaqahmed
Copy link
Member

Thanks for the catch! The "since last event" part was added way before click was a PointerEvent!!

Possible ways forwards for the spec:

  1. Add a special case for click.button. We already have a special case for click.target after a released pointer, so should be fine?
  2. Change click.button to be -1 because this field is redundant with the auxclick event for non-primary buttons. This would be a breaking change IMO.

@mustaqahmed
Copy link
Member

Both Chrome and Firefox show zeroes for click.button and click.buttons.

@smaug----
Copy link
Contributor

smaug---- commented Oct 9, 2024

I think we should special case click in the spec. We can't change the behavior.
And worth to add a note why such special case.

smaug---- added a commit to smaug----/pointerevents that referenced this issue Dec 4, 2024
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

4 participants