Skip to content

Commit d071f10

Browse files
committed
🤖 Fix code review textarea wrapping
The review note textarea was extending horizontally beyond the visible viewport because it was inheriting the width of the scrollable content area (which expands for long diff lines) rather than the visible scrollport width. Solution: Use position: sticky with left: 0 and width: 100% to remove the InlineNoteContainer from the grid flow. This constrains it to the visible scrollport width while keeping it visually positioned below the selected lines. Changes: - InlineNoteContainer: Added position: sticky, left: 0, width: 100% - NoteTextarea: Added overflow-y: auto, white-space: pre-wrap, word-wrap: break-word, box-sizing: border-box Result: Text in the review note input wraps within the visible viewport boundaries. Long diff lines can still scroll horizontally, but the textarea respects the visible container width.
1 parent dee39f5 commit d071f10

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+
/* Remove from grid flow to prevent inheriting wide content width */
337+
position: sticky;
338+
left: 0;
339+
right: 0;
340+
width: 100%;
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)