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

Commit da86e62

Browse files
committed
fix(fab-speed-dial): action items are in tab order when closed
- apply `tabindex="-1"` to all `md-button`s in the `md-fab-actions` Fixes #10101
1 parent a4732a9 commit da86e62

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/components/fabActions/fabActions.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,15 @@
3232

3333
compile: function(element, attributes) {
3434
var children = element.children();
35-
35+
var actionItemButtons;
3636
var hasNgRepeat = $mdUtil.prefixer().hasAttribute(children, 'ng-repeat');
3737

38+
// Action item buttons should not be in the tab order when the speed dial is closed.
39+
actionItemButtons = element.find('md-button');
40+
angular.forEach(actionItemButtons, function(button) {
41+
button.setAttribute('tabindex', -1);
42+
});
43+
3844
// Support both ng-repeat and static content
3945
if (hasNgRepeat) {
4046
children.addClass('md-fab-action-item');
@@ -45,5 +51,4 @@
4551
}
4652
};
4753
}
48-
4954
})();

src/components/fabActions/fabActions.spec.js

+17
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@ describe('<md-fab-actions> directive', function() {
2929
expect(element.find("md-fab-actions").children()).toHaveClass('md-fab-action-item');
3030
}));
3131

32+
it('applies tabindex of -1 to all action item buttons', inject(function() {
33+
build(
34+
'<md-fab-speed-dial>' +
35+
' <md-fab-actions>' +
36+
' <md-button>1</md-button>' +
37+
' <md-button>2</md-button>' +
38+
' <md-button>3</md-button>' +
39+
' </md-fab-actions>' +
40+
'</md-fab-speed-dial>'
41+
);
42+
43+
expect(element.find("md-button").length).toBe(3);
44+
angular.forEach(element.find("md-button"), function(button) {
45+
expect(button.getAttribute('tabindex')).toEqual('-1');
46+
});
47+
}));
48+
3249
angular.forEach(['ng-repeat', 'data-ng-repeat', 'x-ng-repeat'], function(attr) {
3350
it('supports actions created by ' + attr, inject(function() {
3451
build(

0 commit comments

Comments
 (0)