Skip to content

Commit

Permalink
Fix issue #525 The input event is not fired on mouse wheel
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>
  • Loading branch information
AlexandreBonneau committed Jan 24, 2018
1 parent 2847fc9 commit 320cfce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
## Changelog for autoNumeric

### 4.1.0-beta.22
+ Fix issue #525 The `input` event is not fired on mouse wheel

### 4.1.0-beta.21
+ Fix issue #541 The value of a read-only field can be changed with a scroll input

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "autonumeric",
"version": "4.1.0-beta.21",
"version": "4.1.0-beta.22",
"description": "autoNumeric is a standalone Javascript library that provides live *as-you-type* formatting for international numbers and currencies. It supports most international numeric formats and currencies including those used in Europe, Asia, and North and South America.",
"main": "dist/autoNumeric.js",
"readmeFilename": "README.md",
Expand Down
9 changes: 6 additions & 3 deletions src/AutoNumeric.js
@@ -1,8 +1,8 @@
/**
* AutoNumeric.js
*
* @version 4.1.0-beta.21
* @date 2018-01-23 UTC 19:25
* @version 4.1.0-beta.22
* @date 2018-01-24 UTC 00:45
*
* @authors Bob Knothe, Alexandre Bonneau
* @contributors Sokolov Yura and others, cf. AUTHORS
Expand Down Expand Up @@ -872,7 +872,7 @@ export default class AutoNumeric {
* @returns {string}
*/
static version() {
return '4.1.0-beta.21';
return '4.1.0-beta.22';
}

/**
Expand Down Expand Up @@ -7075,6 +7075,9 @@ To solve that, you'd need to either set \`decimalPlacesRawValue\` to \`null\`, o
if (result !== +currentUnformattedValue) {
// Only 'set' the value if it has changed. For instance 'set' should not happen if the user hits a limit and continue to try to go past it since we clamp the value.
this.set(result);

// Since we changed the input value, we send a native `input` event
this._triggerEvent(AutoNumeric.events.native.input, e.target);
}

//XXX Do not prevent if the value is not modified? From a UX point of view, preventing the wheel event when the user use it on top of an autoNumeric element should always be done, even if the value does not change. Perhaps that could affect other scripts relying on this event to be sent though.
Expand Down

0 comments on commit 320cfce

Please sign in to comment.