Skip to content

Commit

Permalink
fix: correctly fit swap input text
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Nov 7, 2022
1 parent 9c6aa0b commit 9288b58
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/widget/src/utils/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9288b58

Please sign in to comment.