From 9d86b06d4cbe4dae8a92cce602546e3ade26691e Mon Sep 17 00:00:00 2001 From: DGryaznykh Date: Mon, 17 Oct 2022 11:09:30 +0300 Subject: [PATCH] Fix scrollbar on mobile issue #333 scrollHeight is rounded. So when scrollHeight is float scrollbar shows on the chrome mobile browser even if there is nowhere to scroll to. I found only one way: increase the scroll by 1 px --- src/calculateNodeHeight.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calculateNodeHeight.ts b/src/calculateNodeHeight.ts index 3f7067eb..3172824c 100644 --- a/src/calculateNodeHeight.ts +++ b/src/calculateNodeHeight.ts @@ -9,7 +9,7 @@ export type CalculatedNodeHeights = number[]; let hiddenTextarea: HTMLTextAreaElement | null = null; const getHeight = (node: HTMLElement, sizingData: SizingData): number => { - const height = node.scrollHeight; + const height = node.scrollHeight + 1; if (sizingData.sizingStyle.boxSizing === 'border-box') { // border-box: add border, since height = content + padding + border