Skip to content

Studio: only dodge an overlay box that reaches the corner stack - #8210

Merged
danielhanchen merged 3 commits into
mainfrom
studio/pin-overlays-to-the-corner
Aug 9, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
studio/pin-overlays-to-the-corner

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

The problem

On a chat page the update banners, the download panel and the loaded models card sit a few hundred pixels up the middle of the page instead of in the bottom-right corner.

The corner stack lifts over anything published to the frame store whose bottom is past the halfway line. The chat composer publishes, and on an empty chat ThreadWelcome pads it down from the top with pt-[27.5dvh] rather than docking it, so its bottom clears the halfway line while the corner underneath it stays free. The stack lifted anyway, and it is one container, so all four overlays went with it.

The change

Dodge only a box that reaches the strip the stack occupies: its own inset plus the shortest the stack ever is, which is the collapsed card. One predicate, applied to both publishers.

box before after
Welcome composer, sits high lifted corner
Docked composer lifted lifted
Monitor at its default corner lifted lifted
Monitor dragged up the screen lifted corner, height capped below it

Why the docked composer still has to be dodged

Not cosmetic. The composer column is max-w-[46rem] centred in the content area, the card is w-[268px] at right-4, and SIDEBAR_WIDTH_DEFAULT is 280, so the card's left edge is viewport - 284 and the composer's right edge is (viewport + sidebar + 736) / 2. They overlap while the viewport is under 1584px:

viewport composer right card left overlap
1280 (playwright_chat_ui.py) 1148 996 152px
1440 1228 1156 72px
1512 1264 1228 36px
1728 1372 1444 clear

With a model loaded the card lands on Send and eats the click, which is what the chat UI suite caught as a 60s timeout on a visible button. So the docked case keeps its lift, and lifting over a docked composer still leaves the stack at the bottom of the screen, roughly 170px up on a 830px window, not adrift in the middle.

Checks

  • npm run typecheck clean
  • npm test: 1313 passing, 0 failing
  • npm run i18n:check:strict passes
  • npm run build succeeds
  • Biome on the changed file: identical findings to main, none new

Three tests added, using boxes measured from a 1280x830 window: the docked composer is dodged, the welcome composer is not, and a monitor away from the corner no longer lifts the stack. All three fail against the old halfway-line rule.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

The corner stack lifts over anything published to the frame store whose
bottom is past the halfway line. The chat composer publishes, and on an
empty chat the welcome layout pads it down from the top rather than
docking it, so it clears that line while leaving the corner free. The
stack lifted anyway: the update banners, the download panel and the
loaded models card all sat in the middle of the page with nothing
underneath them.

Dodge only a box that reaches the strip the stack occupies, which is its
own inset plus the shortest it ever is. A docked composer does and is
still dodged, which matters: the composer column is 46rem and the card
268px, so below a 1584px viewport the card lands on Send, and 1280,
1440 and 1512 are all below it. The welcome composer does not, so the
stack stays in the corner.

Same rule for the other publisher, so a monitor dragged up the screen
stops dragging the stack with it. It is still in the column, so the
height cap keeps the stack clear of it as before.
@shimmyshimmer
shimmyshimmer force-pushed the studio/pin-overlays-to-the-corner branch from d9e2559 to 0969d3c Compare August 9, 2026 04:10
@shimmyshimmer shimmyshimmer changed the title Studio: pin the overlay stack to the bottom-right corner Studio: only dodge an overlay box that reaches the corner stack Aug 9, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member Author

Checked the P1 rather than taking it at face value, and it is right. The numbers, since they are worse than "a narrower window":

The composer column is max-w-[46rem] centred in the content area, the card is w-[268px] at right-4, and SIDEBAR_WIDTH_DEFAULT is 280. So the card's left edge is viewport - 284, the composer's right edge is (viewport + sidebar + 736) / 2, and they overlap while the viewport is under 1584px. That is 1280 (the smoke test), 1440 and 1512, and clear at 1728.

The suggested remedy is only half right though. Keeping the stack clear of the composer unconditionally is what put the banners in the middle of the page in the first place: on an empty chat ThreadWelcome pads the composer down from the top with pt-[27.5dvh], so it clears the halfway line the dodge keys on while leaving the corner underneath it free.

So the gate is now "does the box reach the strip the stack occupies", not "is it past halfway". A docked composer does and keeps its lift, so Send stays clickable. The welcome composer does not, so the stack stays in the corner. The Playwright workaround this comment objected to is gone with it.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

The cutoff was a guess at the shortest the stack ever is, and it did not
line up with stackMaxHeight's own floor. A box ending between 32px above
the cutoff and the cutoff was read as not reaching, so it went to the
capped branch, where the cap could not fit MIN_STACK_ROOM under it and
returned that floor anyway. The stack then overlapped the box by up to
24px: at 830px high with a box ending at 700, the cap came out 120 and
put the stack's top at 694.

Ask the cap instead. A box reaches the stack when the room under it is
less than the stack's floor, which is exactly when the cap would be
impossible, so the two cannot disagree. The floor drops out of
stackMaxHeight with it, since nothing tighter now gets there.

Neither composer case moves: the welcome one keeps the corner, the
docked one keeps its lift. A sweep of every bottom edge on an 830px
window is now a test, so no capped box can overlap the stack again.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c4fbb6cd4c

ℹ️ 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".

if (reachesStack(frame, viewportHeight)) return ownMargin;
// At least MIN_STACK_ROOM by construction: anything tighter reaches, and was
// lifted instead of capped.
return Math.min(ownMargin, roomBelow(frame, viewportHeight, bottomInset));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Re-evaluate capped frames after applying another frame's lift

When a docked composer and a monitor are published together, bottomInset may have been raised by the composer even though this monitor did not satisfy reachesStack at the default inset. For example, with the added 1280×830 composer (top = 664) and a monitor ending at 660, the shared inset is 174 but this returns 830 - 174 - 660 - 8 = -12 for maxHeight; the resulting invalid CSS cap is ignored and the stack overlaps the monitor. Determine reachability using the final shared inset (or lift again) rather than assuming the single-frame cutoff still guarantees MIN_STACK_ROOM after another frame moves the stack.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and reproduced exactly: that pair returns maxHeight: -12. Browsers drop an invalid max-height, so the cap disappeared precisely where it was needed and the stack was free to grow over the monitor.

My own regression, from the previous commit. Removing the MIN_STACK_ROOM floor was justified by "nothing tighter reaches this branch", which holds for one box at the default inset and stops holding the moment another box raises the shared one.

Fixed by settling the inset rather than folding each box against a fixed one. Reachability now takes the inset in force, and stackGeometry keeps asking until no box wants more, which bounds at their count since each can only promote once. That pair now lifts to 438 with a cap of 376, clearing both. The floor stays removed, since it was papering over this rather than preventing it.

Swept every column box from 60 to 814, at four heights, alone and paired with the docked composer: no overlap and no cap at zero or below. Both new tests fail against the previous commit.

Each box was asked whether it crowded the corner at the default inset,
then the largest lift was taken. With two boxes that is wrong in one
direction: lifting over the first moves the stack up into the second,
and a box that had room at the corner has none there.

A docked composer and a monitor ending at 660 on an 830px window hit it.
The composer lifts the stack to 174, the monitor is still read as having
room, so it takes the capped branch and the cap comes out at -12.
Browsers drop an invalid max-height, so the cap vanished exactly where
it was needed and the stack grew over the monitor.

Settle the inset instead: keep asking until no box wants more, which
bounds at their count since each can only promote once. Reachability now
takes the inset in force rather than a fixed one, which is also what
makes the cap safe, so the MIN_STACK_ROOM floor removed last commit
stays gone rather than papering over it again.

Swept every column box against the docked composer: no overlap and no
cap at zero or below.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f78c4c1ade

ℹ️ 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 belowMonitor = viewportHeight - bottomInset - frame.bottom - STACK_GAP;
return Math.max(MIN_STACK_ROOM, Math.min(ownMargin, belowMonitor));
// Lifted over: bottomInset already cleared it.
if (reachesStack(frame, viewportHeight, bottomInset)) return ownMargin;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not treat a capped lift as clearing the frame

When another publisher raises bottomInset enough to make a high monitor reach the stack, liftOver may clamp at viewportHeight - MIN_STACK_ROOM without actually getting above that monitor, yet this branch assumes it was cleared and restores ownMargin. For example, at 830px high, a monitor spanning top=16,bottom=300 plus an expanded docked composer/prompt queue requesting bottomInset>=403 causes the monitor's lift to clamp at 710; the stack then spans y=16..120, directly overlapping the monitor's top controls. Check that the final inset really clears frame.top before taking this branch, and otherwise retain a below-frame cap or another attainable placement.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit da6aeae into main Aug 9, 2026
37 of 45 checks passed
@danielhanchen
danielhanchen deleted the studio/pin-overlays-to-the-corner branch August 9, 2026 05:33
danielhanchen added a commit that referenced this pull request Aug 9, 2026
#8210 rewrote the same two functions on main while this branch was open, so
the overlap resolves in main's favour and the maximised-monitor case is
rebuilt on top of it rather than reverting the refactor.

Kept from main: reachesStack, roomBelow's bottomInset parameter, the settled
inset in stackGeometry. Its "is this box in the way" test replaces this
branch's "is it past the halfway line", and it also subsumes this branch's
second case: a box leaving MIN_STACK_ROOM underneath itself does not reach
the stack, so the corner stays free without a branch of its own.

Kept from this branch: the case main still has no answer for. Bounding the
lift to the stack's floor parks the stack across the box's own top edge, over
the controls it is dodging, which is how a monitor resized to fill the
viewport had its Close button swallowed by the loaded models card. liftOver
goes back to the unbounded lift, liftFits asks whether it fits, and dodgeInset
picks between it and a seat inside the monitor clear of its resize grip.
stackMaxHeight holds the other edge of that seat, below the header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants