summaryrefslogtreecommitdiffstats
path: root/toolkit/content/widgets/datepicker.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-31 07:05:58 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-31 07:05:58 +0200
commit0a2b11d18138283e5fd1520e1230451f2e41a0c9 (patch)
treebdee12d405a6afdca9ed26b74dcd37205c686885 /toolkit/content/widgets/datepicker.js
parent2f54cd30fc6f6c16db7e95819740e1f229b20984 (diff)
downloadUXP-0a2b11d18138283e5fd1520e1230451f2e41a0c9.tar
UXP-0a2b11d18138283e5fd1520e1230451f2e41a0c9.tar.gz
UXP-0a2b11d18138283e5fd1520e1230451f2e41a0c9.tar.lz
UXP-0a2b11d18138283e5fd1520e1230451f2e41a0c9.tar.xz
UXP-0a2b11d18138283e5fd1520e1230451f2e41a0c9.zip
Bug 1397114 - Disable smooth scrolling when value changes come from input box
Diffstat (limited to 'toolkit/content/widgets/datepicker.js')
-rw-r--r--toolkit/content/widgets/datepicker.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/toolkit/content/widgets/datepicker.js b/toolkit/content/widgets/datepicker.js
index f5659b736..4387ae632 100644
--- a/toolkit/content/widgets/datepicker.js
+++ b/toolkit/content/widgets/datepicker.js
@@ -124,7 +124,7 @@ function DatePicker(context) {
/**
* Update date picker and its components.
*/
- _update() {
+ _update(options = {}) {
const { dateKeeper, isMonthPickerVisible } = this.state;
if (isMonthPickerVisible) {
@@ -139,7 +139,8 @@ function DatePicker(context) {
dateObj: dateKeeper.state.dateObj,
months: this.state.months,
years: this.state.years,
- toggleMonthPicker: this.state.toggleMonthPicker
+ toggleMonthPicker: this.state.toggleMonthPicker,
+ noSmoothScroll: options.noSmoothScroll
});
this.components.calendar.setProps({
isVisible: !isMonthPickerVisible,
@@ -260,7 +261,7 @@ function DatePicker(context) {
dateKeeper.setSelection({
year, month, day
});
- this._update();
+ this._update({ noSmoothScroll: true });
}
};
@@ -330,14 +331,14 @@ function DatePicker(context) {
items: props.months,
isInfiniteScroll: true,
isValueSet: this.state.isMonthSet,
- smoothScroll: !this.state.firstOpened
+ smoothScroll: !(this.state.firstOpened || props.noSmoothScroll)
});
this.components.year.setState({
value: props.dateObj.getUTCFullYear(),
items: props.years,
isInfiniteScroll: false,
isValueSet: this.state.isYearSet,
- smoothScroll: !this.state.firstOpened
+ smoothScroll: !(this.state.firstOpened || props.noSmoothScroll)
});
this.state.firstOpened = false;
} else {