Skip to content

Commit 8131f0c

Browse files
committed
Add a draggable conversation pane divider
1 parent 3b3cfbf commit 8131f0c

5 files changed

Lines changed: 71 additions & 2 deletions

File tree

‎docs/implementation/read-only-review.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,5 @@ Validation: 181 unit/integration tests, 19 browser tests, and typecheck pass. A
7878
Single-click submission follow-up: a held `/api/action` browser request reproduced the lack of immediate feedback (the submit button stayed enabled with no saving state). Question/change submission now shows Saving immediately, disables submission while a review action or refresh is in progress, and scrolls the saved note into view. Failures explicitly retain the draft for refresh/retry. The delayed-request regression checks one click produces exactly one stored question and one agent invocation; a lost first click was not independently reproduced.
7979

8080
Answer scrolling: when an asynchronous answer or failure arrives, Conversation follows the bottom if the reader was already within 32 pixels of it. Scrolling up keeps the current position through polling updates. Only the conversation list scrolls; the code pane and composer stay in place. Browser regressions cover both arrival at the bottom and arrival while reading earlier messages; the bottom-follow test failed before the fix with a 1,302-pixel gap.
81+
82+
Conversation width: drag the divider on its left edge to resize between 280 and 480 pixels. Focus the divider and use Left/Right for 20-pixel steps or Home/End for the limits. The width survives collapsing/reopening the pane within the page; reloading uses the layout default. This replaces the hard-to-discover native corner resize grip. The browser regression covers pointer dragging, keyboard limits, code-pane space, and collapse/reopen.

‎test/browser/review.spec.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,15 @@ for (const readingEarlier of [false,true]) test(`answer arrival ${readingEarlier
165165
if(readingEarlier) expect(await notes.evaluate(element=>element.scrollTop)).toBeCloseTo(before,0);
166166
else await expect.poll(()=>notes.evaluate(element=>element.scrollHeight-element.clientHeight-element.scrollTop)).toBeLessThan(2);
167167
});
168+
test('resizes Conversation using its divider and keyboard',async({page})=>{
169+
await page.goto(app.url);const pane=page.locator('#conversation-pane');const divider=page.getByRole('separator',{name:'Resize conversation'});
170+
await expect(divider).toBeVisible();const initial=(await pane.boundingBox())!.width;const handle=(await divider.boundingBox())!;
171+
await page.mouse.move(handle.x+handle.width/2,handle.y+100);await page.mouse.down();await page.mouse.move(handle.x-100,handle.y+100);await page.mouse.up();
172+
expect((await pane.boundingBox())!.width).toBeGreaterThan(initial+90);
173+
await divider.press('Home');await expect(divider).toHaveAttribute('aria-valuenow','280');
174+
await divider.press('ArrowLeft');await expect(divider).toHaveAttribute('aria-valuenow','300');
175+
await divider.press('End');await expect(divider).toHaveAttribute('aria-valuenow','480');
176+
expect((await page.locator('.code-pane').boundingBox())?.width ?? 0).toBeGreaterThan(400);
177+
await page.getByRole('button',{name:'Collapse conversation',exact:true}).click();await expect(divider).toBeHidden();
178+
await page.getByRole('button',{name:'Conversation',exact:true}).click();await expect(divider).toBeVisible();expect((await pane.boundingBox())!.width).toBe(480);
179+
});

‎web/public/app.js‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,4 +582,43 @@ $("settings").onclick=async()=>{
582582
} catch(error){$("dialog-body").textContent=error.message;}
583583
};
584584

585+
const conversationResize = $("conversation-resize");
586+
const conversationPane = $("conversation-pane");
587+
function resizeConversation(width) {
588+
const bounded = Math.round(Math.max(280, Math.min(480, width)));
589+
conversationPane.style.width = `${bounded}px`;
590+
conversationResize.setAttribute("aria-valuenow", String(bounded));
591+
}
592+
let conversationDrag;
593+
conversationResize.onpointerdown = event => {
594+
if (event.button !== 0) return;
595+
event.preventDefault();
596+
conversationDrag = { x: event.clientX, width: conversationPane.getBoundingClientRect().width };
597+
conversationResize.setPointerCapture(event.pointerId);
598+
conversationResize.focus();
599+
document.body.classList.add("resizing-conversation");
600+
};
601+
conversationResize.onpointermove = event => {
602+
if (conversationDrag) resizeConversation(conversationDrag.width + conversationDrag.x - event.clientX);
603+
};
604+
function endConversationResize() {
605+
conversationDrag = null;
606+
document.body.classList.remove("resizing-conversation");
607+
}
608+
conversationResize.onpointerup = event => {
609+
if (conversationResize.hasPointerCapture(event.pointerId)) conversationResize.releasePointerCapture(event.pointerId);
610+
endConversationResize();
611+
};
612+
conversationResize.onpointercancel = endConversationResize;
613+
conversationResize.onlostpointercapture = endConversationResize;
614+
conversationResize.onkeydown = event => {
615+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
616+
event.preventDefault();
617+
resizeConversation(event.key === "Home" ? 280 : event.key === "End" ? 480 : conversationPane.getBoundingClientRect().width + (event.key === "ArrowLeft" ? 20 : -20));
618+
};
619+
new ResizeObserver(() => {
620+
const width = conversationPane.getBoundingClientRect().width;
621+
if (width) conversationResize.setAttribute("aria-valuenow", String(Math.round(width)));
622+
}).observe(conversationPane);
623+
585624
await refresh();

‎web/public/index.html‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ <h1 id="item-title">Linking changes to plan items…</h1>
8585
<div id="code" tabindex="0"></div>
8686
<div id="checks" class="check-strip"></div>
8787
</section>
88-
<aside class="conversation-pane" aria-label="Conversation">
88+
<div id="conversation-resize" role="separator" tabindex="0" aria-label="Resize conversation" aria-orientation="vertical" aria-controls="conversation-pane" aria-valuemin="280" aria-valuemax="480" aria-valuenow="344"></div>
89+
<aside id="conversation-pane" class="conversation-pane" aria-label="Conversation">
8990
<div class="pane-heading">
9091
CONVERSATION
9192
<button

‎web/public/style.css‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ pre {
465465
flex-direction: column;
466466
background: var(--surface);
467467
border-left: 1px solid var(--line);
468-
resize: horizontal;
469468
overflow: auto;
470469
}
471470
.tabs {
@@ -680,3 +679,19 @@ dialog::backdrop {
680679
.agent-answer { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
681680
.agent-answer p { white-space: pre-wrap; overflow-wrap: anywhere; }
682681
#question-provider { display: block; width: 100%; margin: 8px 0; }
682+
683+
#conversation-resize {
684+
flex: 0 0 6px;
685+
cursor: col-resize;
686+
touch-action: none;
687+
background: var(--line);
688+
}
689+
#conversation-resize:hover, #conversation-resize:focus-visible { background: var(--primary); }
690+
body.resizing-conversation { cursor: col-resize; user-select: none; }
691+
@media (min-width: 1440px) {
692+
body.conversation-closed #conversation-resize { display: none; }
693+
}
694+
@media (max-width: 1439px) {
695+
#conversation-resize { display: none; }
696+
body.conversation-open #conversation-resize { display: block; }
697+
}

0 commit comments

Comments
 (0)