YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(chat): ignore a 1px rounding gap before scrolling the composer
Manas Raghuwanshi556f5aeeecaf
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/composer-input-box.test.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/composer-input-box.test.tsxindex 8656e17a2..4d7173603 100644--- a/apps/screenpipe-app-tauri/components/chat/standalone/composer-input-box.test.tsx+++ b/apps/screenpipe-app-tauri/components/chat/standalone/composer-input-box.test.tsx@@ -99,6 +99,23 @@ describe("ComposerInputBox", () => {expect(textarea.style.overflowY).toBe("auto");});+ it("does not scroll for a 1px rounding difference", () => {+ const { container, rerender } = render(composer("short"));+ const textarea = container.querySelector("textarea")!;+ // WebKit under page zoom can report the content 1px taller than the height+ // it was just given.+ Object.defineProperty(textarea, "clientHeight", {+ configurable: true,+ get(this: HTMLTextAreaElement) {+ return Math.min(parseFloat(this.style.height) || 0, MAX_HEIGHT) - 1;+ },+ });++ rerender(composer("one\ntwo\nthree"));+ expect(textarea.style.height).toBe("82px");+ expect(textarea.style.overflowY).toBe("hidden");+ });+it("keeps its height while hidden instead of collapsing", () => {const { container, rerender } = render(composer("one\ntwo\nthree"));const textarea = container.querySelector("textarea")!;diff --git a/packages/workflows-ui/src/chat-primitives.tsx b/packages/workflows-ui/src/chat-primitives.tsxindex 3292bd48a..ecd330e81 100644--- a/packages/workflows-ui/src/chat-primitives.tsx+++ b/packages/workflows-ui/src/chat-primitives.tsx@@ -117,7 +117,8 @@ function fitToContent(element: HTMLTextAreaElement) {// must not resize the box.if (element.value) {element.style.height = `${element.scrollHeight}px`;- element.style.overflowY = element.scrollHeight > element.clientHeight ? "auto" : "hidden";+ // WebKit can round scrollHeight 1px past the height just set (page zoom).+ element.style.overflowY = element.scrollHeight - element.clientHeight > 1 ? "auto" : "hidden";}if (parent) parent.style.minHeight = parentMinHeight;}