Skip to content

Commit 630e326

Browse files
Valentin HervieuValentin Hervieu
authored andcommitted
Handle switching min/max with mouse when keyboardSupport is on.
1 parent 7ad989f commit 630e326

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
/**
@@ -1421,6 +1417,8 @@
14211417
this.tracking = 'rzSliderHigh';
14221418
this.minH.removeClass('rz-active');
14231419
this.maxH.addClass('rz-active');
1420+
if (this.options.keyboardSupport)
1421+
this.maxH[0].focus();
14241422
valueChanged = true;
14251423
} else if (this.tracking === 'rzSliderHigh' && newValue <= this.scope.rzSliderModel) {
14261424
this.scope[this.tracking] = this.scope.rzSliderModel;
@@ -1429,6 +1427,8 @@
14291427
this.tracking = 'rzSliderModel';
14301428
this.maxH.removeClass('rz-active');
14311429
this.minH.addClass('rz-active');
1430+
if (this.options.keyboardSupport)
1431+
this.minH[0].focus();
14321432
valueChanged = true;
14331433
}
14341434
}

0 commit comments

Comments
 (0)