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

fix(tab): IE9 disabled attr renders grey text on enabled tab #2677

Closed
wants to merge 3 commits 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tabs/docs/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<tabset>
<tab heading="Static title">Static content</tab>
<tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disabled="tab.disabled">
<tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disable="tab.disabled">
{{tab.content}}
</tab>
<tab select="alertMe()">
Expand Down
5 changes: 3 additions & 2 deletions src/tabs/docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ AngularJS version of the tabs directive.
_(Defaults: false)_ :
Whether tab is currently selected.

* `disabled` <i class="glyphicon glyphicon-eye-open"></i>
* `disable` <i class="glyphicon glyphicon-eye-open"></i>
_(Defaults: false)_ :
Whether tab is clickable and can be activated.
Note that this deprecates the "disabled" attribute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

Note that this was previously the `disabled` attribute.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or

Note that this was previously the `disabled` attribute, which is now deprecated.


* `select()`
_(Defaults: null)_ :
An optional expression called when tab is activated.

* `deselect()`
_(Defaults: null)_ :
An optional expression called when tab is deactivated.
An optional expression called when tab is deactivated.
13 changes: 12 additions & 1 deletion src/tabs/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ angular.module('ui.bootstrap.tabs', [])
</file>
</example>
*/
.directive('tab', ['$parse', function($parse) {
.directive('tab', ['$parse', '$log', function($parse, $log) {
return {
require: '^tabset',
restrict: 'EA',
Expand All @@ -208,7 +208,18 @@ angular.module('ui.bootstrap.tabs', [])
});

scope.disabled = false;
if ( attrs.disable ) {
scope.$parent.$watch($parse(attrs.disable), function(value) {
scope.disabled = !! value;
});
}

// Deprecation support of "disabled" parameter
// fix(tab): IE9 disabled attr renders grey text on enabled tab #2677
// This code is duplicated from the lines above to make it easy to remove once
// the feature has been completely deprecated
if ( attrs.disabled ) {
$log.warn('Use of "disabled" attribute has been deprecated, please use "disable"');
scope.$parent.$watch($parse(attrs.disabled), function(value) {
scope.disabled = !! value;
});
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/test/tabs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ describe('tabs', function() {
];
elm = $compile([
'<tabset>',
' <tab ng-repeat="t in tabs" active="t.active" select="t.select()" disabled="t.disabled">',
' <tab ng-repeat="t in tabs" active="t.active" select="t.select()" disable="t.disabled">',
' <tab-heading><b>heading</b> {{index}}</tab-heading>',
' content {{$index}}',
' </tab>',
Expand Down