Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(dropdown): do not close on right click
Browse files Browse the repository at this point in the history
- Do not close the dropdown on right click when open due to Firefox's
  behavior

Closes #5052
Fixes #5051
  • Loading branch information
wesleycho committed Dec 14, 2015
1 parent 2a1aaf2 commit bf1768e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])

if (evt && openScope.getAutoClose() === 'disabled') { return; }

if (evt && evt.which === 3) { return; }

var toggleElement = openScope.getToggleElement();
if (evt && toggleElement && toggleElement[0].contains(evt.target)) {
return;
Expand Down
9 changes: 9 additions & 0 deletions src/dropdown/test/dropdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ describe('uib-dropdown', function() {
expect(element).toHaveClass(dropdownConfig.openClass);
});

it('should not close on right click', function() {
clickDropdownToggle();
element.find('ul a').trigger({
type: 'mousedown',
which: 3
});
expect(element).toHaveClass(dropdownConfig.openClass);
});

it('should close on $location change', function() {
clickDropdownToggle();
expect(element).toHaveClass(dropdownConfig.openClass);
Expand Down

0 comments on commit bf1768e

Please sign in to comment.