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

Commit 8b33de6

Browse files
caitppetebacondarwin
authored andcommitted
fix($location): don't rewrite when link is shift-clicked
Closes #9904 Closes #9906
1 parent d40749c commit 8b33de6

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 || event.button == 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
@@ -1539,6 +1539,19 @@ describe('$location', function() {
15391539
});
15401540

15411541

1542+
it('should not rewrite when clicked with shift pressed', function() {
1543+
configureService({linkHref: 'base/a?b=c', html5Mode: true, supportHist: true});
1544+
inject(
1545+
initBrowser(),
1546+
initLocation(),
1547+
function($browser) {
1548+
browserTrigger(link, 'click', { keys: ['shift'] });
1549+
expectNoRewrite($browser);
1550+
}
1551+
);
1552+
});
1553+
1554+
15421555
it('should not mess up hash urls when clicking on links in hashbang mode', function() {
15431556
var base;
15441557
module(function() {

0 commit comments

Comments
 (0)