Repository navigation
Studio: make the run settings panel draggable - #7566
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3dc2b93acc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const asideRef = useRef<HTMLElement>(null); | ||
| const t = useT(); | ||
| const { | ||
| width: settingsWidth, |
There was a problem hiding this comment.
Recompute prompt overflow after resizing the panel
When a user resizes the panel across the width where the inline system prompt starts or stops wrapping, systemPromptOverflows remains stale because its measurement effect only depends on currentSystemPrompt and open. A newly overflowing prompt therefore may not open the popup editor when clicked, while a prompt widened enough to fit may still open it unnecessarily; remeasure when settingsWidth changes or observe the textarea's size.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in 5cd5574. The effect depended on [currentSystemPrompt, open], which was sufficient while the panel was a fixed width, so this is a regression this PR introduces rather than something pre-existing.
Went with observing the box rather than adding settingsWidth to the deps, because the drag lands the live width through a custom property without a re-render, so a width dependency would not fire until release and the affordance would lag the whole drag.
Verified by replicating the prompt box and its effect under Playwright: with the observer removed the flag stays false at both extremes, and with it in place it flips true when the panel is dragged to its minimum and back to false when widened. Passing in Chromium, Firefox and WebKit.
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 279d6fd436
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const observer = new ResizeObserver(measure); | ||
| observer.observe(el); | ||
| return () => observer.disconnect(); | ||
| }, [currentSystemPrompt, open]); |
There was a problem hiding this comment.
Reattach the prompt observer after the textarea remounts
When the System Prompt section is collapsed, CollapsibleSection unmounts its textarea, but this observer remains attached to that detached element and the effect dependencies do not change when the section reopens. If the panel is resized while the section is closed, the newly mounted textarea is never observed and systemPromptOverflows retains the result from the old width, causing clicks to incorrectly open the editor or fail to open it for overflowing text. Track the section's mounted state or use a callback ref that observes each new textarea.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and thanks for catching it. CollapsibleSection renders {open && <div className="pb-7">{children}</div>}, so collapsing the section genuinely unmounts the textarea. The stored observer kept watching the detached node, and the effect deps never changed on remount, so a panel resize while the section was closed left the overflow state stale.
Fixed in 0613243 by observing through a callback ref, so the observer always follows the live element:
const attachPromptBox = useCallback((node: HTMLTextAreaElement | null) => {
systemPromptBoxRef.current = node;
promptObserverRef.current?.disconnect();
promptObserverRef.current = null;
if (!node || typeof ResizeObserver === "undefined") return;
const observer = new ResizeObserver(() => measurePromptRef.current());
observer.observe(node);
promptObserverRef.current = observer;
measurePromptRef.current();
}, []);Added a regression test for the exact sequence: widen the panel, collapse the section, resize while the textarea is unmounted, reopen, then assert the overflow flag matches the new width. It fails before the change and passes after. Full suite is 264/264 across Chromium 149, Firefox 151 and WebKit 26.5.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a10112db70
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // browser sends next, whether it ended in a release or a cancel. This also | ||
| // runs as the effect cleanup, where no drag happened and a bare click from | ||
| // assistive tech must still get through. | ||
| if (dragRef.current) handledRef.current = true |
There was a problem hiding this comment.
Clear the click guard when a drag is canceled
When an active pointer stream is canceled—for example, after an OS gesture or input-device interruption—no compatibility click follows that canceled sequence, yet endDrag() leaves handledRef armed. If the next activation is a bare synthesized click from switch or voice control, the onClick handler consumes it without toggling the panel. Arm the guard only on pointerup, or explicitly clear it on pointercancel.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right about the underlying problem, though the specific fix needed a bit of care. Two cases end a pointer sequence and they behave differently:
- A synthetic
pointercancelfollowed by a real mouse release. The browser still emits a compatibility click, so clearing the guard on cancel reintroduces the collapse-on-release bug that an earlier regression test already covers. - A genuine cancel, for example the OS taking over the pointer. No click follows, so a boolean guard stays armed forever and swallows the next click from switch or voice control. That is the bug you found.
A flag cannot distinguish the two, so I replaced it with a timestamp window in 6d89fc3 (cherry-picked onto #7561 as e0938f4):
const CLICK_COMPAT_WINDOW_MS = 300
...
if (Date.now() - handledAtRef.current < CLICK_COMPAT_WINDOW_MS) return
onToggle()The compatibility click lands in the same tick, so it is still suppressed, and the guard self-heals after 300ms so a later assistive-technology click gets through. Keyboard toggles never arm it at all.
Both cases are now covered: the existing cancel-then-release test still passes, and a new test cancels the drag, waits past the window, dispatches a bare click and asserts it toggles. 264/264 across Chromium 149, Firefox 151 and WebKit 26.5.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
The chat run settings panel was fixed at 17rem. It now uses the same drag handle as the sidebar, on its left edge, between 248px and 560px and capped at 40% of the window. The width persists and syncs across tabs. Reuses PanelResizeHandle and createPanelWidthStore, so behaviour matches the sidebar exactly. The panel width key joins the preference reset list. The system prompt overflow check now runs off a ResizeObserver attached through a callback ref. A drag changes the width through a custom property without re-rendering, and the collapsible section unmounts the textarea, so a stored observer would miss both.
869a962 to
9bc656c
Compare
|
Rebased onto #7561 was squash merged, so this branch was carrying the same changes under different commit hashes and every one of them collided. Rather than replay that history I reset the branch to
Everything shared ( Two things on Verified after the rebase: |
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Follows #7561, which landed
PanelResizeHandleandcreatePanelWidthStore. Now rebased ontomainand standalone.The right-hand run settings panel is fixed at 17rem. Long preset names and the system prompt box have no room while the chat column often has space to spare, so this gives the panel the same draggable edge as the sidebar.
Behaviour
Identical to the sidebar, mirrored: the handle sits on the panel's left edge and the panel grows as the pointer moves left.
chat_settings_width, separate fromsidebar_width, so the two panels are independent.The handle only renders while the panel is open, since closed it is 0px wide and there is no edge to grab. It is reopened from the existing toggle.
Sharing
No second copy of the drag logic. The direction inversion is a single
edgeprop, which the shared handle already had, and the store is the same factory with a different key, floor and ceiling.Testing
npm run typecheck,npm run buildand the unit tests pass.Also driven under Playwright in Chromium, Firefox and WebKit against the real components: default width, handle placement on the left edge, inverted drag direction, clamping at both ends, no close-by-drag, persistence across reload, viewport cap and restore, cancelled drags, keyboard, and independence from the sidebar's stored width. 192 assertions, all passing in all three engines.