diff --git a/src/directives/stateDirectives.ts b/src/directives/stateDirectives.ts index 5e6a8cf35..07540e813 100644 --- a/src/directives/stateDirectives.ts +++ b/src/directives/stateDirectives.ts @@ -95,7 +95,7 @@ function clickHook( const button = e.which || e.button, target = getDef(); - if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) { + if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || el.attr('target'))) { // HACK: This is to allow ng-clicks to be processed before the transition is initiated: const transition = $timeout(function () { if (!el.attr('disabled')) { diff --git a/test/stateDirectivesSpec.ts b/test/stateDirectivesSpec.ts index 54e26b482..84d77c957 100644 --- a/test/stateDirectivesSpec.ts +++ b/test/stateDirectivesSpec.ts @@ -232,6 +232,18 @@ describe('uiStateRef', function () { expect(obj($stateParams)).toEqual({}); })); + it('should not transition states when alt-clicked', inject(function ($state, $stateParams, $q) { + expect($state.$current.name).toEqual('top'); + expect(obj($stateParams)).toEqual({}); + + triggerClick(el, { altKey: true }); + timeoutFlush(); + $q.flush(); + + expect($state.current.name).toEqual('top'); + expect(obj($stateParams)).toEqual({}); + })); + it('should not transition states when middle-clicked', inject(function ($state, $stateParams, $q) { expect($state.$current.name).toEqual('top'); expect(obj($stateParams)).toEqual({});