Skip to content

Commit 4ebb630

Browse files
Valentin HervieuValentin Hervieu
authored andcommitted
Handle switching min/max with mouse when keyboardSupport is on.
1 parent 7a3b398 commit 4ebb630

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

dist/rzslider.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@
11591159
this.ticks.on('touchstart', angular.bind(this, this.onMove, this.ticks));
11601160

11611161
if (this.options.keyboardSupport) {
1162-
this.minH.on('focus', angular.bind(this, this.onPointerFocus, this.minH, 'rzSliderModel'))
1162+
this.minH.on('focus', angular.bind(this, this.onPointerFocus, this.minH, 'rzSliderModel'));
11631163
if (this.range) {
11641164
this.maxH.on('focus', angular.bind(this, this.onPointerFocus, this.maxH, 'rzSliderHigh'));
11651165
}
@@ -1269,14 +1269,14 @@
12691269
this.callOnEnd();
12701270
},
12711271

1272-
onPointerFocus: function(pointer, ref, event) {
1272+
onPointerFocus: function(pointer, ref) {
12731273
this.tracking = ref;
12741274
pointer.one('blur', angular.bind(this, this.onPointerBlur, pointer));
12751275
pointer.on('keydown', angular.bind(this, this.onKeyboardEvent));
12761276
pointer.addClass('rz-active');
12771277
},
12781278

1279-
onPointerBlur: function(pointer, event) {
1279+
onPointerBlur: function(pointer) {
12801280
pointer.off('keydown');
12811281
this.tracking = '';
12821282
pointer.removeClass('rz-active');
@@ -1312,11 +1312,7 @@
13121312

13131313
var newValue = this.roundStep(this.sanitizeValue(action)),
13141314
newOffset = this.valueToOffset(newValue);
1315-
var switched = this.positionTrackingHandle(newValue, newOffset);
1316-
if (switched) {
1317-
var pointer = this.tracking === 'rzSliderModel' ? this.minH : this.maxH;
1318-
pointer[0].focus(); //to focus the correct pointer
1319-
}
1315+
this.positionTrackingHandle(newValue, newOffset);
13201316
},
13211317

13221318
/**
@@ -1423,6 +1419,8 @@
14231419
this.tracking = 'rzSliderHigh';
14241420
this.minH.removeClass('rz-active');
14251421
this.maxH.addClass('rz-active');
1422+
if (this.options.keyboardSupport)
1423+
this.maxH[0].focus();
14261424
valueChanged = true;
14271425
} else if (this.tracking === 'rzSliderHigh' && newValue <= this.scope.rzSliderModel) {
14281426
switched = true;
@@ -1432,6 +1430,8 @@
14321430
this.tracking = 'rzSliderModel';
14331431
this.maxH.removeClass('rz-active');
14341432
this.minH.addClass('rz-active');
1433+
if (this.options.keyboardSupport)
1434+
this.minH[0].focus();
14351435
valueChanged = true;
14361436
}
14371437
}

0 commit comments

Comments
 (0)