Skip to content

Commit 6e68e7e

Browse files
committed
noUiSlider 14.6.0
1 parent f442a1d commit 6e68e7e

File tree

6 files changed

+45
-10
lines changed

6 files changed

+45
-10
lines changed

CHANGELOG.MD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### 14.6.0 (*2020-06-27*)
4+
- Added: `keyboardPageMultiplier` and `keyboardDefaultStep` options (#1083);
5+
- Fixed: Ignore erroneous tap events for iOS (#1057, #1079);
6+
37
### 14.5.0 (*2020-05-20*)
48
- Added: Support for `margin`, `padding` and `limit` on non-linear sliders (#911, #1030, #1031, #1071);
59

distribute/nouislider.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! nouislider - 14.5.0 - 5/11/2020 */
1+
/*! nouislider - 14.6.0 - 6/27/2020 */
22
/* Functional styling;
33
* These styles are required for noUiSlider to function.
44
* You don't need to change these rules to apply your design.

distribute/nouislider.js

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! nouislider - 14.5.0 - 5/11/2020 */
1+
/*! nouislider - 14.6.0 - 6/27/2020 */
22
(function(factory) {
33
if (typeof define === "function" && define.amd) {
44
// AMD. Register as an anonymous module.
@@ -13,7 +13,7 @@
1313
})(function() {
1414
"use strict";
1515

16-
var VERSION = "14.5.0";
16+
var VERSION = "14.6.0";
1717

1818
//region Helper Methods
1919

@@ -654,6 +654,22 @@
654654
parsed.singleStep = entry;
655655
}
656656

657+
function testKeyboardPageMultiplier(parsed, entry) {
658+
if (!isNumeric(entry)) {
659+
throw new Error("noUiSlider (" + VERSION + "): 'keyboardPageMultiplier' is not numeric.");
660+
}
661+
662+
parsed.keyboardPageMultiplier = entry;
663+
}
664+
665+
function testKeyboardDefaultStep(parsed, entry) {
666+
if (!isNumeric(entry)) {
667+
throw new Error("noUiSlider (" + VERSION + "): 'keyboardDefaultStep' is not numeric.");
668+
}
669+
670+
parsed.keyboardDefaultStep = entry;
671+
}
672+
657673
function testRange(parsed, entry) {
658674
// Filter incorrect input.
659675
if (typeof entry !== "object" || Array.isArray(entry)) {
@@ -987,6 +1003,8 @@
9871003
// Tests are executed in the order they are presented here.
9881004
var tests = {
9891005
step: { r: false, t: testStep },
1006+
keyboardPageMultiplier: { r: false, t: testKeyboardPageMultiplier },
1007+
keyboardDefaultStep: { r: false, t: testKeyboardDefaultStep },
9901008
start: { r: true, t: testStart },
9911009
connect: { r: true, t: testConnect },
9921010
direction: { r: true, t: testDirection },
@@ -1015,7 +1033,9 @@
10151033
orientation: "horizontal",
10161034
keyboardSupport: true,
10171035
cssPrefix: "noUi-",
1018-
cssClasses: cssClasses
1036+
cssClasses: cssClasses,
1037+
keyboardPageMultiplier: 5,
1038+
keyboardDefaultStep: 10
10191039
};
10201040

10211041
// AriaFormat defaults to regular format, if any.
@@ -1856,6 +1876,13 @@
18561876

18571877
// Move closest handle to tapped location.
18581878
function eventTap(event) {
1879+
// Erroneous events seem to be passed in occasionally on iOS/iPadOS after user finishes interacting with
1880+
// the slider. They appear to be of type MouseEvent, yet they don't have usual properties set. Ignore tap
1881+
// events that have no touches or buttons associated with them.
1882+
if (!event.buttons && !event.touches) {
1883+
return false;
1884+
}
1885+
18591886
// The tap event shouldn't propagate up
18601887
event.stopPropagation();
18611888

@@ -1943,7 +1970,7 @@
19431970
var to;
19441971

19451972
if (isUp || isDown) {
1946-
var multiplier = 5;
1973+
var multiplier = options.keyboardPageMultiplier;
19471974
var direction = isDown ? 0 : 1;
19481975
var steps = getNextStepsForHandle(handleNumber);
19491976
var step = steps[direction];
@@ -1955,7 +1982,11 @@
19551982

19561983
// No step set, use the default of 10% of the sub-range
19571984
if (step === false) {
1958-
step = scope_Spectrum.getDefaultStep(scope_Locations[handleNumber], isDown, 10);
1985+
step = scope_Spectrum.getDefaultStep(
1986+
scope_Locations[handleNumber],
1987+
isDown,
1988+
options.keyboardDefaultStep
1989+
);
19591990
}
19601991

19611992
if (isLargeUp || isLargeDown) {

distribute/nouislider.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

distribute/nouislider.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nouislider",
3-
"version": "14.5.0",
3+
"version": "14.6.0",
44
"main": "distribute/nouislider.js",
55
"style": "distribute/nouislider.min.css",
66
"license": "MIT",

0 commit comments

Comments
 (0)