Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 68e9c69

Browse files
author
Valentin Hervieu
committed
test(keyboardSupport): Complete full test coverage for keyboard controls
1 parent efcacbe commit 68e9c69

File tree

4 files changed

+413
-15
lines changed

4 files changed

+413
-15
lines changed

dist/rzslider.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@
418418
*/
419419
resetSlider: function() {
420420
this.manageElementsStyle();
421+
this.addAccessibility();
421422
this.setMinAndMax();
422423
this.updateCeilLab();
423424
this.updateFloorLab();
@@ -645,15 +646,19 @@
645646
addAccessibility: function() {
646647
this.minH.attr('role', 'slider');
647648
this.updateAriaAttributes();
648-
if (this.options.keyboardSupport)
649+
if (this.options.keyboardSupport && !(this.options.readOnly || this.options.disabled))
649650
this.minH.attr('tabindex', '0');
651+
else
652+
this.minH.attr('tabindex', '');
650653
if (this.options.vertical)
651654
this.minH.attr('aria-orientation', 'vertical');
652655

653656
if (this.range) {
654657
this.maxH.attr('role', 'slider');
655-
if (this.options.keyboardSupport)
658+
if (this.options.keyboardSupport && !(this.options.readOnly || this.options.disabled))
656659
this.maxH.attr('tabindex', '0');
660+
else
661+
this.maxH.attr('tabindex', '');
657662
if (this.options.vertical)
658663
this.maxH.attr('aria-orientation', 'vertical');
659664
}
@@ -1370,13 +1375,21 @@
13701375
newMinValue = newValue;
13711376
newMinOffset = newOffset;
13721377
newMaxValue = newValue + difference;
1373-
if (newMaxValue > this.maxValue) return;
1378+
if (newMaxValue > this.maxValue) {
1379+
newMaxValue = this.maxValue;
1380+
newMinValue = newMaxValue - difference;
1381+
newMinOffset = this.valueToOffset(newMinValue);
1382+
}
13741383
newMaxOffset = this.valueToOffset(newMaxValue);
13751384
} else {
13761385
newMaxValue = newValue;
13771386
newMaxOffset = newOffset;
13781387
newMinValue = newValue - difference;
1379-
if (newMinValue < this.minValue) return;
1388+
if (newMinValue < this.minValue) {
1389+
newMinValue = this.minValue;
1390+
newMaxValue = newMinValue + difference;
1391+
newMaxOffset = this.valueToOffset(newMaxValue);
1392+
}
13801393
newMinOffset = this.valueToOffset(newMinValue);
13811394
}
13821395
this.positionTrackingBar(newMinValue, newMaxValue, newMinOffset, newMaxOffset);

0 commit comments

Comments
 (0)