From 8a4f625ef6cc9846f975c58f01eed32a75e85ebe Mon Sep 17 00:00:00 2001 From: Jonathan Perez Date: Thu, 20 Oct 2016 16:39:02 -0400 Subject: [PATCH] fix(modal): revert focus behavior on open - On open, do not focus the first focusable element Closes #6295 --- src/modal/modal.js | 1 - src/modal/test/modal.spec.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modal/modal.js b/src/modal/modal.js index 8c5a3df3ba..3fd0e9de2f 100644 --- a/src/modal/modal.js +++ b/src/modal/modal.js @@ -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(); } diff --git a/src/modal/test/modal.spec.js b/src/modal/test/modal.spec.js index 5ab1939f1a..86f0a107c7 100644 --- a/src/modal/test/modal.spec.js +++ b/src/modal/test/modal.spec.js @@ -526,7 +526,7 @@ describe('$uibModal', function() { var modal = open({template: '
Content
'}); $rootScope.$digest(); - expect(document.activeElement.tagName).toBe('BUTTON'); + expect(document.activeElement.className.split(' ')).toContain('modal'); expect($document).toHaveModalsOpen(1); triggerKeyDown($document, 27); @@ -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');