Search code examples
angularjsfocusangular-ui-bootstrapangular-ui-bootstrap-tab

UI Bootstrap and modal with tabs: the first tab is focused with a border


I have a UI Bootstrap modal with uib-tabs within. When I open the modal the first tab is "browser-focused" surrounded with a blue border, like this:

Blue border in tab

I'm using:

  • angular 1.5.8
  • Bootstrap css 3.3.7
  • UI Bootstrap 2.2.0

Here's a plunkr: https://plnkr.co/edit/HjKjHegAQ1ReY39lSD2V?p=preview

js Code of the plunkr:

angular.module('fooApp', ['ui.bootstrap']);

angular.module("fooApp").controller("fooController", ["$scope", "$uibModal", function($scope, $uibModal) {

    $scope.openModal = function () {

        var modalScope = $scope.$new();

        var modalInstance = $uibModal.open({
            templateUrl: 'modal.html',
            controller: 'modalController',
            scope: modalScope,
            size: 'lg'
        });

        modalInstance.result.then(function (result) {
        }, null);
    };

}]);

angular.module("fooApp").controller("modalController", ["$scope", "$timeout", function($scope, $timeout) {

}]);

html of the plunkr:

<div class="modal-body">
    <uib-tabset>
        <uib-tab select="ngGridFix()">
            <uib-tab-heading>
                <i class="glyphicon glyphicon-file" style="margin-right: 15px"></i>
                <strong>Foo</strong>
            </uib-tab-heading>

            <p>Foo</p>

        </uib-tab>
        <uib-tab select="ngGridFix()">
            <uib-tab-heading>
                <i class="glyphicon glyphicon-question-sign" style="margin-right: 15px"></i>
                <strong>Help</strong>
            </uib-tab-heading>

            <p>Help</p>
        </uib-tab>
    </uib-tabset>
</div>

Any clues on how to remove this blue border?


Solution

  • Ugh... I updated to bootstrap ui 2.5.0 (from 2.2.0) and this got solved (no blue border)

    It appears to be fixed in bootstrap ui 2.3.1

    https://github.com/angular-ui/bootstrap/blob/master/CHANGELOG.md

    modal: revert focus behavior on open(8a4f625), closes #6295