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

Shift + Click is not handled #9904

Closed
vict-shevchenko opened this issue Nov 4, 2014 · 9 comments
Closed

Shift + Click is not handled #9904

vict-shevchenko opened this issue Nov 4, 2014 · 9 comments

Comments

@vict-shevchenko
Copy link

Hello!

As I know browsers open links in a new window, when clicking on them with a 'Shift + Click'. But Angular prevents this, and open link in a current tab(window). This can be observed on main angular website.

As I see the issue is in a $locationProvider

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

it seems to me that it is missing event.shiftKey

Can you advise, it this a really miss or a default behavior?

Thank You!

@caitp
Copy link
Contributor

caitp commented Nov 4, 2014

it's really difficult, we don't even correctly detect non-primary-clicks all the time.

There is some work being done to do a better job of this (UI Events), but nothing that has really shipped yet.

However, for the shift+click case, we could probably make this work.

@vict-shevchenko
Copy link
Author

Thank You!

If my proposition works well, can I make a pull request? May be you can give me a green light if it is ok.

@caitp
Copy link
Contributor

caitp commented Nov 4, 2014

It's going to need an e2e test, which might be a bit difficult to write, but if you can do it before me then i'll certainly review your PR and land it

@caitp
Copy link
Contributor

caitp commented Nov 4, 2014

@vict-shevchenko so are you positive shift-click should open a new window in all supported browsers, regardless of configuration?

@vict-shevchenko
Copy link
Author

I don`t think I can do it faster than you, especially e2e test )

i think if we do

if (!html5Mode.rewriteLinks || event.shiftKey || event.ctrlKey || event.metaKey || event.which == 2) return;

this will cause default browser handling of shift + click, what it opening in new window in most browsers.

@caitp
Copy link
Contributor

caitp commented Nov 4, 2014

yes --- the question is really, will this do the right thing for all target browsers. I'm hoping that it does.

It turns out an E2E test isn't really needed, since the browser won't open a new window because of a fake mouse event, so it should be fine to just unit test it

@vict-shevchenko
Copy link
Author

I think that we should not care about that, as this is browser responsibility. We just allow browser do his default action for shift + click.

So if there will exist browser that do something else on shift + click, he will do it on every web site, so the behavior will be predictable for user. and Angular just won`t block that.

@petebacondarwin petebacondarwin modified the milestones: 1.3.x, 1.3.2 Nov 5, 2014
@petebacondarwin
Copy link
Contributor

@caitp - can we put new issues into 1.3.x unless they are severe regressions that need immediate attention? Otherwise we are never going to empty this milestone. If necessary we can create a 1.3.3 for "reasonably" urgent issues that we definitely should look at in the next iteration.

@vict-shevchenko
Copy link
Author

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.