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

Commit 939ca37

Browse files
fix($location): don't rewrite when link is shift-clicked
Closes #9904 Closes #9906
1 parent 4ae8a2a commit 939ca37

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/ng/location.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ function $LocationProvider() {
837837
// TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
838838
// currently we open nice url link and redirect then
839839

840-
if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.which == 2) return;
840+
if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;
841841

842842
var elm = jqLite(event.target);
843843

test/ng/locationSpec.js

+13
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,19 @@ describe('$location', function() {
15051505
});
15061506

15071507

1508+
it('should not rewrite when clicked with shift pressed', function() {
1509+
configureService({linkHref: 'base/a?b=c', html5Mode: true, supportHist: true});
1510+
inject(
1511+
initBrowser(),
1512+
initLocation(),
1513+
function($browser) {
1514+
browserTrigger(link, 'click', { keys: ['shift'] });
1515+
expectNoRewrite($browser);
1516+
}
1517+
);
1518+
});
1519+
1520+
15081521
it('should not mess up hash urls when clicking on links in hashbang mode', function() {
15091522
var base;
15101523
module(function() {

0 commit comments

Comments
 (0)