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

Commit 47cfe44

Browse files
devversionThomasBurleson
authored andcommitted
fix(slider): allow tabindex overwrite
* add test for tabindex overwriting Fixes #5829. Closes #5830.
1 parent 0873ace commit 47cfe44

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/components/slider/slider.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ function SliderDirective($$rAF, $window, $mdAria, $mdUtil, $mdConstant, $mdThemi
7474
// **********************************************************
7575

7676
function compile (tElement, tAttrs) {
77-
tElement.attr({
78-
tabIndex: 0,
79-
role: 'slider'
80-
});
77+
if (!tAttrs.tabindex) tElement.attr('tabindex', 0);
78+
tElement.attr('role', 'slider');
8179

8280
$mdAria.expect(tElement, 'aria-label');
8381

src/components/slider/slider.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,14 @@ describe('md-slider', function() {
285285

286286
});
287287

288+
it('should set a default tabindex', function() {
289+
var slider = setup();
290+
expect(slider.attr('tabindex')).toBe('0');
291+
});
292+
293+
it('should not overwrite tabindex attribute', function() {
294+
var slider = setup('tabindex="2"');
295+
expect(slider.attr('tabindex')).toBe('2');
296+
});
297+
288298
});

0 commit comments

Comments
 (0)