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

Commit

Permalink
fix(modal): revert focus behavior on open
Browse files Browse the repository at this point in the history
- On open, do not focus the first focusable element

Closes #6295
  • Loading branch information
ajpz authored and wesleycho committed Nov 27, 2016
1 parent 7be6653 commit 8a4f625
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p

$modalStack.modalRendered = function(modalInstance) {
var modalWindow = openedWindows.get(modalInstance);
$modalStack.focusFirstFocusableElement($modalStack.loadFocusElementList(modalWindow));
if (modalWindow) {
modalWindow.value.renderDeferred.resolve();
}
Expand Down
4 changes: 2 additions & 2 deletions src/modal/test/modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ describe('$uibModal', function() {

var modal = open({template: '<div>Content<button>inside modal</button></div>'});
$rootScope.$digest();
expect(document.activeElement.tagName).toBe('BUTTON');
expect(document.activeElement.className.split(' ')).toContain('modal');
expect($document).toHaveModalsOpen(1);

triggerKeyDown($document, 27);
Expand Down Expand Up @@ -698,7 +698,7 @@ describe('$uibModal', function() {
$rootScope.$digest();
$animate.flush();

expect(document.activeElement.tagName).toBe('INPUT');
expect(document.activeElement.className.split(' ')).toContain('modal');

close(modal, 'closed ok');

Expand Down

0 comments on commit 8a4f625

Please sign in to comment.