Bug 1549987 - Improve scrolling feel for quick open r=jlast
authorDavid Walsh <dwalsh@mozilla.com>
Fri, 10 May 2019 15:08:40 +0000
changeset 532234 b97aef38d5565a7c16879aac056ccaa7542a1d15
parent 532233 a379c628a109147aa28215138c43c130393195ae
child 532235 fdfc7f74c157199e6bb88da583f0e9b3b88aec0f
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1549987
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1549987 - Improve scrolling feel for quick open r=jlast Removes the smoothscrolling for QuickOpen Differential Revision: https://phabricator.services.mozilla.com/D30420
devtools/client/debugger/src/components/QuickOpenModal.js
devtools/client/debugger/src/utils/result-list.js
--- a/devtools/client/debugger/src/components/QuickOpenModal.js
+++ b/devtools/client/debugger/src/components/QuickOpenModal.js
@@ -110,21 +110,17 @@ export class QuickOpenModal extends Comp
     }
   }
 
   componentDidUpdate(prevProps: Props) {
     const nowEnabled = !prevProps.enabled && this.props.enabled;
     const queryChanged = prevProps.query !== this.props.query;
 
     if (this.refs.resultList && this.refs.resultList.refs) {
-      scrollList(
-        this.refs.resultList.refs,
-        this.state.selectedIndex,
-        nowEnabled || !queryChanged
-      );
+      scrollList(this.refs.resultList.refs, this.state.selectedIndex);
     }
 
     if (nowEnabled || queryChanged) {
       this.updateResults(this.props.query);
     }
   }
 
   closeModal = () => {
--- a/devtools/client/debugger/src/utils/result-list.js
+++ b/devtools/client/debugger/src/utils/result-list.js
@@ -1,42 +1,31 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
 
 // @flow
 
 import { isFirefox } from "devtools-environment";
-import { transitionTimeout } from "../components/shared/Modal";
 
-export function scrollList(
-  resultList: Element[],
-  index: number,
-  delayed: boolean = false
-): void {
+export function scrollList(resultList: Element[], index: number): void {
   if (!resultList.hasOwnProperty(index)) {
     return;
   }
 
   const resultEl = resultList[index];
 
   const scroll = () => {
     if (isFirefox()) {
-      resultEl.scrollIntoView({ block: "center", behavior: "smooth" });
+      resultEl.scrollIntoView({ block: "nearest", behavior: "auto" });
     } else {
       chromeScrollList(resultEl, index);
     }
   };
 
-  if (delayed) {
-    // Wait for Modal Transition timeout before scrolling to resultEl.
-    setTimeout(scroll, transitionTimeout + 10);
-    return;
-  }
-
   scroll();
 }
 
 function chromeScrollList(elem: Element, index: number): void {
   const resultsEl: any = elem.parentNode;
 
   if (!resultsEl || resultsEl.children.length === 0) {
     return;