mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 14:52:16 +00:00
Bug 1549987 - Improve scrolling feel for quick open r=jlast
Removes the smoothscrolling for QuickOpen Differential Revision: https://phabricator.services.mozilla.com/D30420 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
fd514440a1
commit
e8f079b017
@ -115,11 +115,7 @@ export class QuickOpenModal extends Component<Props, State> {
|
||||
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) {
|
||||
|
@ -5,13 +5,8 @@
|
||||
// @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;
|
||||
}
|
||||
@ -20,18 +15,12 @@ export function scrollList(
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user