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

In Firefox, onClick is triggered by middle and right mouse buttons #1273

Closed
alebedev opened this issue Feb 6, 2018 · 4 comments
Closed

In Firefox, onClick is triggered by middle and right mouse buttons #1273

alebedev opened this issue Feb 6, 2018 · 4 comments
Labels

Comments

@alebedev
Copy link

alebedev commented Feb 6, 2018

Observed Behaviour

Inferno is firing onClick handlers in Firefox when user presses middle or right mouse button on element.

See original Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=184051

Since it's 15 years old, Inferno probably needs workaround.

Expected Current Behaviour

Inferno should not dispatch onClick events in Firefox when event.button !== 0

Inferno Metadata

Firefox-only, any version

@Havunen
Copy link
Member

Havunen commented Feb 6, 2018

But If we stop those events how does one implement right click event listener?

@kurdin
Copy link
Contributor

kurdin commented Feb 12, 2018

@Havunen,
Looks like @alebedev has a point with this. React 16 does not trigger right onClick event but Inferno 4 does in FireFox.

Check in FireFox and Chrome:
React: https://jsfiddle.net/gykgq6gq/
Inferno: https://jsfiddle.net/zzfa2yvL/

For actual right click events/menus you need to use document.addEventListener('contextmenu', this._handleContextMenu); on componentDidMount:
Here is example converted from React: https://jsfiddle.net/bpd1m62d/

@Havunen
Copy link
Member

Havunen commented Feb 12, 2018

Okay I see now, We can fix it for next minor version :)

@Havunen
Copy link
Member

Havunen commented Feb 13, 2018

It is now tested / fixed, and will be available in next release. 4.0.3

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

No branches or pull requests

3 participants