π OpenHands: AI-Driven Development
fix(chat): make long /btw responses scrollable (#16116)
KXHfd9145958e9e
diff --git a/__tests__/components/chat/btw-messages.test.tsx b/__tests__/components/chat/btw-messages.test.tsxindex 048cefbdcc..686132eea5 100644--- a/__tests__/components/chat/btw-messages.test.tsx+++ b/__tests__/components/chat/btw-messages.test.tsx@@ -40,6 +40,25 @@ describe("<BtwMessages />", () => {expect(entriesFor(CONV)).toEqual([]);});+ it("keeps long responses in a scrollable region", () => {+ const id = useBtwStore.getState().addPending(CONV, "why?");+ const longResponse = Array.from(+ { length: 100 },+ (_, index) => `Response line ${index + 1}`,+ ).join("\n");+ useBtwStore.getState().resolve(CONV, id, longResponse);++ render(<BtwMessages conversationId={CONV} />);++ expect(screen.getByTestId("btw-messages")).toHaveClass(+ "max-h-[40vh]",+ "overflow-y-auto",+ "overscroll-contain",+ "custom-scrollbar-always",+ );+ expect(screen.getByText(/Response line 100/)).toBeInTheDocument();+ });+it("does not render entries from other conversations", () => {useBtwStore.getState().addPending("other-conv", "not mine");const { container } = render(<BtwMessages conversationId={CONV} />);diff --git a/src/components/features/chat/btw-messages.tsx b/src/components/features/chat/btw-messages.tsxindex 3e512ae4cf..c462b1df70 100644--- a/src/components/features/chat/btw-messages.tsx+++ b/src/components/features/chat/btw-messages.tsx@@ -17,7 +17,10 @@ export function BtwMessages({ conversationId }: BtwMessagesProps) {if (!conversationId || entries.length === 0) return null;return (- <div data-testid="btw-messages" className="flex flex-col w-full">+ <div+ data-testid="btw-messages"+ className="custom-scrollbar-always flex max-h-[40vh] w-full flex-col overflow-y-auto overscroll-contain"+ >{entries.map((entry) => {const isPending = entry.status === "pending";return (