From 22e5c3a20019c98976d135299e9436b524bdc3eb Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sun, 24 Oct 2021 19:12:25 +0100 Subject: [PATCH] Desktop: Fixed Goto Anything scrolling for long lists --- packages/app-desktop/plugins/GotoAnything.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/app-desktop/plugins/GotoAnything.tsx b/packages/app-desktop/plugins/GotoAnything.tsx index c5b644a411..9b9a794c70 100644 --- a/packages/app-desktop/plugins/GotoAnything.tsx +++ b/packages/app-desktop/plugins/GotoAnything.tsx @@ -151,6 +151,8 @@ class Dialog extends React.PureComponent { inputHelpWrapper: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, }; + delete this.styles_[styleKey].dialogBox.maxHeight; + const rowTextStyle = { fontSize: theme.fontSize, color: theme.color, @@ -559,12 +561,17 @@ class Dialog extends React.PureComponent { } } + private calculateMaxHeight(itemHeight: number) { + const maxItemCount = Math.floor((0.7 * window.innerHeight) / itemHeight); + return maxItemCount * itemHeight; + } + renderList() { const style = this.style(); const itemListStyle = { marginTop: 5, - height: Math.min(style.itemHeight * this.state.results.length, 10 * style.itemHeight), + height: Math.min(style.itemHeight * this.state.results.length, this.calculateMaxHeight(style.itemHeight)), }; return (