|
644 | 644 | * Updates aria attributes according to current values |
645 | 645 | */ |
646 | 646 | updateAriaAttributes: function() { |
647 | | - this.minH.attr('aria-valuenow', this.scope.rzSliderModel); |
648 | | - this.minH.attr('aria-valuetext', this.customTrFn(this.scope.rzSliderModel)); |
649 | | - this.minH.attr('aria-valuemin', this.minValue); |
650 | | - this.minH.attr('aria-valuemax', this.maxValue); |
| 647 | + this.minH.attr({ |
| 648 | + 'aria-valuenow': this.scope.rzSliderModel, |
| 649 | + 'aria-valuetext': this.customTrFn(this.scope.rzSliderModel), |
| 650 | + 'aria-valuemin': this.minValue, |
| 651 | + 'aria-valuemax': this.maxValue |
| 652 | + }); |
651 | 653 | if (this.range) { |
652 | | - this.maxH.attr('aria-valuenow', this.scope.rzSliderHigh); |
653 | | - this.maxH.attr('aria-valuetext', this.customTrFn(this.scope.rzSliderHigh)); |
654 | | - this.maxH.attr('aria-valuemin', this.minValue); |
655 | | - this.maxH.attr('aria-valuemax', this.maxValue); |
| 654 | + this.maxH.attr({ |
| 655 | + 'aria-valuenow': this.scope.rzSliderHigh, |
| 656 | + 'aria-valuetext': this.customTrFn(this.scope.rzSliderHigh), |
| 657 | + 'aria-valuemin': this.minValue, |
| 658 | + 'aria-valuemax': this.maxValue |
| 659 | + }); |
656 | 660 | } |
657 | 661 | }, |
658 | 662 |
|
|
1117 | 1121 | return Math.abs(offset - this.minH.rzsp) < Math.abs(offset - this.maxH.rzsp) ? this.minH : this.maxH; |
1118 | 1122 | }, |
1119 | 1123 |
|
| 1124 | + /** |
| 1125 | + * Wrapper function to focus an angular element |
| 1126 | + * |
| 1127 | + * @param el {AngularElement} the element to focus |
| 1128 | + */ |
| 1129 | + focusElement: function(el) { |
| 1130 | + var DOM_ELEMENT = 0; |
| 1131 | + el[DOM_ELEMENT].focus(); |
| 1132 | + }, |
| 1133 | + |
1120 | 1134 | /** |
1121 | 1135 | * Bind mouse and touch events to slider handles |
1122 | 1136 | * |
|
1208 | 1222 | pointer.addClass('rz-active'); |
1209 | 1223 |
|
1210 | 1224 | if (this.options.keyboardSupport) |
1211 | | - pointer[0].focus(); |
| 1225 | + this.focusElement(pointer); |
1212 | 1226 |
|
1213 | 1227 | ehMove = angular.bind(this, this.dragging.active ? this.onDragMove : this.onMove, pointer); |
1214 | 1228 | ehEnd = angular.bind(this, this.onEnd, ehMove); |
|
1420 | 1434 | this.minH.removeClass('rz-active'); |
1421 | 1435 | this.maxH.addClass('rz-active'); |
1422 | 1436 | if (this.options.keyboardSupport) |
1423 | | - this.maxH[0].focus(); |
| 1437 | + this.focusElement(this.maxH); |
1424 | 1438 | valueChanged = true; |
1425 | 1439 | } else if (this.tracking === 'rzSliderHigh' && newValue <= this.scope.rzSliderModel) { |
1426 | 1440 | switched = true; |
|
1431 | 1445 | this.maxH.removeClass('rz-active'); |
1432 | 1446 | this.minH.addClass('rz-active'); |
1433 | 1447 | if (this.options.keyboardSupport) |
1434 | | - this.minH[0].focus(); |
| 1448 | + this.focusElement(this.minH); |
1435 | 1449 | valueChanged = true; |
1436 | 1450 | } |
1437 | 1451 | } |
|
0 commit comments