From 9aa4ee7803e8fdaefb0231d0f18f930953461b04 Mon Sep 17 00:00:00 2001 From: Cameron Dutro Date: Thu, 30 Nov 2023 13:25:27 -0800 Subject: [PATCH] Update src/index.js Co-authored-by: Jon Rohan --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index db0b0a2..19c6010 100644 --- a/src/index.js +++ b/src/index.js @@ -50,8 +50,8 @@ export default function autosize(textarea, {viewportMarginBottom = 100} = {}) { const textareaStyle = getComputedStyle(textarea) - const topBorderWidth = Math.round(parseFloat(textareaStyle.borderTopWidth)) - const bottomBorderWidth = Math.round(parseFloat(textareaStyle.borderBottomWidth)) + const topBorderWidth = Math.ceil(parseFloat(textareaStyle.borderTopWidth)) + const bottomBorderWidth = Math.ceil(parseFloat(textareaStyle.borderBottomWidth)) const isBorderBox = textareaStyle.boxSizing === 'border-box' const borderAddOn = isBorderBox ? topBorderWidth + bottomBorderWidth : 0