Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(nav-bar): non-selected tabs with anchors have invalid tabindex va…
Browse files Browse the repository at this point in the history
…lue (#11675)

md-button was applying tabindex="0" to all non-disabled anchors
this affects md-nav-sref and md-nav-href

Fixes #11637
  • Loading branch information
Splaktar authored and mmalerba committed Mar 13, 2019
1 parent d56d0e7 commit ec9aa25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/components/button/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ function MdButtonDirective($mdButtonInkRipple, $mdTheming, $mdAria, $mdInteracti
// Use async expect to support possible bindings in the button label
$mdAria.expectWithoutText(element, 'aria-label');

// For anchor elements, we have to set tabindex manually when the
// element is disabled
if (isAnchor(attr) && angular.isDefined(attr.ngDisabled)) {
// For anchor elements, we have to set tabindex manually when the element is disabled.
// We don't do this for md-nav-bar anchors as the component manages its own tabindex values.
if (isAnchor(attr) && angular.isDefined(attr.ngDisabled) &&
!element.hasClass('_md-nav-button')) {
scope.$watch(attr.ngDisabled, function(isDisabled) {
element.attr('tabindex', isDisabled ? -1 : 0);
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/navBar/navBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ MdNavItemController.prototype.getButtonEl = function() {
};

/**
* Set the selected state of the tab and update the tabindex.
* Set the selected state of the tab and updates the tabindex.
* This function is called for the oldTab and newTab when selection changes.
* @param {boolean} isSelected true to select the tab, false to deselect the tab
*/
Expand Down

0 comments on commit ec9aa25

Please sign in to comment.