diff --git a/packages/widget/src/utils/input.ts b/packages/widget/src/utils/input.ts index 9be1655cd..96d2dc8ac 100644 --- a/packages/widget/src/utils/input.ts +++ b/packages/widget/src/utils/input.ts @@ -15,7 +15,9 @@ export const fitInputText = ( mid = (high + low) >> 1; const fontSize = `${mid + 1}px`; element.style.fontSize = fontSize; - if (element.scrollWidth <= element.clientWidth) { + // scrollWidth has different rounding than clientWidth, remove 1px for consistency + const scrollWidth = element.scrollWidth - 1; + if (scrollWidth <= element.clientWidth) { size = mid; low = mid + 1; } else {