aurelia / binding

A modern databinding library for JavaScript and HTML.
MIT License
111 stars 96 forks source link

click.delegate firing for all clicks on firefox rather than just left click #750

Closed AaronJY closed 6 months ago

AaronJY commented 5 years ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior: When I click an element with a click delegate (click.delegate), the handler fires for all click types (left, right, middle) but only of Firefox

Expected/desired behavior:

bigopon commented 5 years ago

@AaronJY thanks for filing this bug. It's interesting that FF behaves differently. I'm not sure how we should fix it, adding a check just for quirky browsers or doing something else?

cc @fkleuver @EisenbergEffect

AaronJY commented 5 years ago

No worries. I think a quick check on the value of event.which from the click event would be adequate enough on the surface, though I'm not sure if there's something crazier going on that is impacting FF specifically that needs to be addressed 🤔 If anybody with more experience with the code could shed some light before I start digging that would be ideal - happy to take a look myself though!

It's worth mentioning that I've tested the behavior on the latest version of Aurelia as well, so we're sure it's not been fixed in a later version! Here's a sandbox with an example: https://codesandbox.io/s/001jo2ql7l

Only left-clicking the Trigger link will update the textbox, however any clicks on the Delegate link will update it.

EisenbergEffect commented 5 years ago

Interesting. It's funny we hadn't hit this before now. I wonder if it was a change in FF or if nobody just really cared which mouse button triggered it before. We could definitely add a check on which of click events. @bigopon What do you think? (We'd also need to port this over to vNext if we do that.)

bigopon commented 6 months ago

Sorry this somehow slipped. Just a note that in v2 this is very simple via event modifier:

<button click.trigger:left="onLeftClick()">
AaronJY commented 6 months ago

All good! I was just cleaning up some of my stale open issues.