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

fix(modal): focus defaults to the modal itself, not the first element #6295

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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