From abb1ac346529b0437bcd228cc9f110adbab05aac Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:10:09 +0800 Subject: [PATCH] fix: popup width growth on click fix: #902 fix: #870 --- src/modules/popup.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/popup.ts b/src/modules/popup.ts index fb034262..613449f4 100644 --- a/src/modules/popup.ts +++ b/src/modules/popup.ts @@ -209,8 +209,9 @@ export function buildReaderPopup( const textarea = popup.querySelector( `#${makeId("text")}`, ) as HTMLTextAreaElement; - if (popup.scrollWidth > textarea.offsetWidth + 10) { - textarea.style.width = `${popup.scrollWidth - 10}px`; + const outerWidth = 10; + if (popup.scrollWidth > textarea.offsetWidth + outerWidth) { + textarea.style.width = `${popup.scrollWidth - outerWidth}px`; } }, },