Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Programmatic bootstrapping makes routed links navigate on mouse down in Firefox #2668

Closed
vsviridov opened this issue May 15, 2013 · 7 comments

Comments

@vsviridov
Copy link

Normally when one right-clicks on links one would expect a context menu, however under certain conditions navigation occurs instead.

Here's a test case
http://plnkr.co/edit/H6qR9BRwHEqoYzVlp1Dw

@btford btford closed this as completed Aug 24, 2013
@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

@vsviridov
Copy link
Author

Still reproducible in 1.0.7 and 1.2.0-rc1
http://plnkr.co/edit/2FNzVKeUMJnkVxXBB6CJ?p=preview

@btford btford reopened this Aug 24, 2013
@guzart
Copy link
Contributor

guzart commented May 9, 2014

Yup, I am having this same issue with Firefox 28, 29 with angular v1.3.0-build.2647+sha.fcc3a7a.

Using firebug I think I found what could be the problem.

Firefox right click is e.which === 3, so it's not caught by this line, and the location event handling goes through.

if (event.ctrlKey || event.metaKey || event.which == 2) return;

UI-Router has this logic to allow browser handling except for left clicks
https://github.com/angular-ui/ui-router/blob/master/src/stateDirectives.js#L129

I dunno if angular location is doing something fancy when event.which > 1

@csharpsi
Copy link

Looks like that could be causing the problem. I think there needs to be a e.which === 2 || e.button === 3 as suggested in this SO answer http://stackoverflow.com/questions/4235426/how-can-i-capture-the-right-click-event-in-javascript#4235486

I'll clone the repo now and see if that fixes it, if it does I'll submit a PR.

@caitp
Copy link
Contributor

caitp commented May 10, 2014

You need to wait for the DOM to be parsed, unfortunately, because otherwise the $compiler won't really do its job right. Here's an example http://plnkr.co/edit/nGtVeAqG0tjbtkYYZ1Hl?p=preview (in some browsers, the DOM may be loaded before scripts are evaluated, in others it may not be) --- the right click thing is an issue with $location though...

I think we can't always trust which or button properties, from the DOM3 spec: https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-MouseEvent-button it's like, you really have no idea which role these buttons are playing in user interactions. It's really silly that we don't do something like say "this event's UI role is navigation / context menu / scrolling / whatever", because that would make a lot more sense than trying to sort out which button does what.

But I guess we should change this to '> 1' rather than '== 2' to benefit Mozilla, for now

@csharpsi
Copy link

Yeah, I thought it would be too easy for that to be the problem. It didn't work.

Just read your comment update, @caitp and you're right doing > 1 has resolved it. But, I'm curious, will this cause other problems? It doesn't seem to at first glance.

@Narretz
Copy link
Contributor

Narretz commented Jun 12, 2015

The right-click behavior is fixed in 1.3.16 and 1.4.0.

@Narretz Narretz closed this as completed Jun 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants