summaryrefslogtreecommitdiffstats
path: root/toolkit/content/widgets/spinner.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-02-14 12:32:46 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-02-14 12:32:46 +0100
commit8fd370c9f39b4bc1d78cc0f763bf4e99dfd0c382 (patch)
tree143c53ae7354d818334835d10db283c4624a78fd /toolkit/content/widgets/spinner.js
parent30c683d986ffec16096c39f473feec23aed7b18d (diff)
downloadUXP-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.js18
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();
+ }
},
/**