Skip to content

Commit 30dda76

Browse files
committed
🤖 Fix code review textarea wrapping
The review note textarea was extending horizontally beyond visible boundaries instead of wrapping text to fit the container width. Changes: - NoteTextarea: Added max-width: 100% and box-sizing: border-box - NoteTextarea: Changed overflow-y from hidden to auto for scrolling - NoteTextarea: Added white-space: pre-wrap to wrap long lines - NoteTextarea: Added word-wrap: break-word to break long words - InlineNoteContainer: Added max-width: 100% and overflow: visible Result: Text in the review note input wraps within visible boundaries. The parent container remains scrollable while the textarea itself prevents horizontal overflow.
1 parent dee39f5 commit 30dda76

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/components/shared/DiffRenderer.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,16 @@ const InlineNoteContainer = styled.div`
333333
background: #1e1e1e;
334334
border-top: 1px solid hsl(from var(--color-review-accent) h s l / 0.3);
335335
margin: 0;
336+
/* Constrain to scrollport width, not content width */
337+
width: fit-content;
338+
min-width: min(100%, 100vw);
339+
max-width: min(100%, 100vw);
340+
overflow: hidden;
336341
`;
337342

338343
const NoteTextarea = styled.textarea`
339344
width: 100%;
345+
max-width: 100%;
340346
min-height: calc(12px * 1.4 * 3 + 12px); /* 3 lines + padding */
341347
padding: 6px 8px;
342348
font-family: var(--font-monospace);
@@ -347,7 +353,11 @@ const NoteTextarea = styled.textarea`
347353
border-radius: 2px;
348354
color: var(--color-text);
349355
resize: none; /* Disable manual resize since we auto-grow */
350-
overflow-y: hidden; /* Hide scrollbar during auto-grow */
356+
overflow-y: auto; /* Allow scrolling for tall content */
357+
overflow-x: hidden; /* Prevent horizontal scroll */
358+
white-space: pre-wrap; /* Wrap long lines to fit visible boundaries */
359+
word-wrap: break-word; /* Break long words if needed */
360+
box-sizing: border-box; /* Include padding in width calculation */
351361
352362
&:focus {
353363
outline: none;

0 commit comments

Comments
 (0)