diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-02-14 12:32:46 +0100 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-02-14 12:32:46 +0100 |
commit | 8fd370c9f39b4bc1d78cc0f763bf4e99dfd0c382 (patch) | |
tree | 143c53ae7354d818334835d10db283c4624a78fd /toolkit/content/widgets/spinner.js | |
parent | 30c683d986ffec16096c39f473feec23aed7b18d (diff) | |
download | UXP-8fd370c9f39b4bc1d78cc0f763bf4e99dfd0c382.tar UXP-8fd370c9f39b4bc1d78cc0f763bf4e99dfd0c382.tar.gz UXP-8fd370c9f39b4bc1d78cc0f763bf4e99dfd0c382.tar.lz UXP-8fd370c9f39b4bc1d78cc0f763bf4e99dfd0c382.tar.xz UXP-8fd370c9f39b4bc1d78cc0f763bf4e99dfd0c382.zip |
Bug 1283385: Implement UI for <input type="date">
Diffstat (limited to 'toolkit/content/widgets/spinner.js')
-rw-r--r-- | toolkit/content/widgets/spinner.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/toolkit/content/widgets/spinner.js b/toolkit/content/widgets/spinner.js index 208ab1931..b3d996fb5 100644 --- a/toolkit/content/widgets/spinner.js +++ b/toolkit/content/widgets/spinner.js @@ -98,7 +98,7 @@ function Spinner(props, context) { setState(newState) { const { spinner } = this.elements; const { value, items } = this.state; - const { value: newValue, items: newItems, isValueSet, isInvalid } = newState; + const { value: newValue, items: newItems, isValueSet, isInvalid, smoothScroll = true } = newState; if (this._isArrayDiff(newItems, items)) { this.state = Object.assign(this.state, newState); @@ -106,16 +106,18 @@ function Spinner(props, context) { this._scrollTo(newValue, true); } else if (newValue != value) { this.state = Object.assign(this.state, newState); - this._smoothScrollTo(newValue); - } - - if (isValueSet) { - if (isInvalid) { - this._removeSelection(); + if (smoothScroll) { + this._smoothScrollTo(newValue, true); } else { - this._updateSelection(); + this._scrollTo(newValue, true); } } + + if (isValueSet && !isInvalid) { + this._updateSelection(); + } else { + this._removeSelection(); + } }, /** |