diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-31 07:05:58 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-31 07:05:58 +0200 |
commit | 0a2b11d18138283e5fd1520e1230451f2e41a0c9 (patch) | |
tree | bdee12d405a6afdca9ed26b74dcd37205c686885 /toolkit/content/widgets/spinner.js | |
parent | 2f54cd30fc6f6c16db7e95819740e1f229b20984 (diff) | |
download | UXP-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/spinner.js')
-rw-r--r-- | toolkit/content/widgets/spinner.js | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/toolkit/content/widgets/spinner.js b/toolkit/content/widgets/spinner.js index 6ef929f8a..4901320b5 100644 --- a/toolkit/content/widgets/spinner.js +++ b/toolkit/content/widgets/spinner.js @@ -123,8 +123,6 @@ function Spinner(props, context) { /** * Whenever scroll event is detected: * - Update the index state - * - If a smooth scroll has reached its destination, set [isScrolling] state - * to false * - If the value has changed, update the [value] state and call [setValue] * - If infinite scrolling is on, reset the scrolling position if necessary */ @@ -137,14 +135,8 @@ function Spinner(props, context) { const value = itemsView[this.state.index + viewportTopOffset].value; - // Check if smooth scrolling has reached its destination. - // This prevents input box jump when input box changes values. - if (this.state.value == value && this.state.isScrolling) { - this.state.isScrolling = false; - } - - // Call setValue if value has changed, and is not smooth scrolling - if (this.state.value != value && !this.state.isScrolling) { + // Call setValue if value has changed + if (this.state.value != value) { this.state.value = value; this.props.setValue(value); } @@ -443,10 +435,6 @@ function Spinner(props, context) { _smoothScrollToIndex(index) { const element = this.elements.spinner.children[index]; if (element) { - // Set the isScrolling flag before smooth scrolling begins - // and remove it when it has reached the destination. - // This prevents input box jump when input box changes values - this.state.isScrolling = true; element.scrollIntoView({ behavior: "smooth", block: "start" }); |