Skip to content

Branch picker chevrons: give back the 24px hit target in the same 20px slot - #12781

Merged
danielhanchen merged 6 commits into
mainfrom
ci-branch-chevron-target
Oct 6, 2026
Merged

danielhanchen merged 6 commits into
mainfrom
ci-branch-chevron-target

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Frontend build + bundle sanity fails on main in its Browser check for user message timestamps step (for example #12770 and #12772):

tests/studio/playwright_user_message_time.py, line 173, in check
    assert rect["width"] >= 24, geometry
AssertionError: {... {'x': 279.625, 'right': 299.625, 'width': 20, ...}, {'x': 321.609375, 'right': 341.609375, 'width': 20, ...}]}

It reproduces locally on main (d68515afd0 and later). It was hidden until the earlier steps of that job went green (#12749, #12763).

Which side is wrong

#12735 restyled the branch picker chevrons as small glyphs with no hover fill. In doing so it changed .aui-branch-chevron-btn from h-8 w-6 (32x24) to size-[20px]. #12173 made 24px the minimum for every control in the user message footer ("Copy/Edit/Fork/Delete and branch targets must retain their size"), which is the WCAG 2.2 target-size floor. The test is right. The visual change in #12735 is intended, but the hit area did not need to shrink with it.

Change

The chevron button itself is unchanged: still the 20px slot, scaled, so the glyph, the hover colour and the keyboard focus ring are drawn exactly as on main. An invisible, absolutely positioned ::before extends the hit target to at least 24px:

  • The floor is 24px times the browser Interface Scale (as browser zoom would scale it), not the UI font size. At the 12px font the slot is 16px and the target is still 24px.
  • The extra width goes only toward the 1/2 count between the chevrons, which is not a control, never toward Delete on the outer side, which at small font sizes sits closer than the extra.
  • Being positioned, the ::before paints over the count, so a press on that extra width reaches the chevron. Padding or a larger box does not: the count is painted later and takes the press.
  • The chevrons carry block margins of half the extra, so the target's reach above and below the box is reserved in layout: inside one row with the actions it fits the row's height, and a wrapped picker row grows to hold it rather than reaching into the actions above.
  • The count has a minimum width of both extensions plus 1px, so the two targets cannot meet over a short count in a narrow custom chat font. Any wider count, the usual case, is unchanged.

Verification

tests/studio/playwright_user_message_time.py now measures each footer control's real target (its box plus any positioned ::before) and hit tests the middle of every edge with elementFromPoint, at nine layouts including the 12px font, 50% and 200% Interface Scale, and a narrow count. It also requires no two targets to overlap, and the chevron's own box to stay square and unpadded so the focus ring stays centred on the glyph.

CSS Result
main fails: the chevron's inner edge reaches the count, and the target is 20px
a 24px box with negative margins and padding (an earlier version here) fails: the count takes presses on the padding, and the focus ring grows off centre
::before with pointer-events: none fails: the extended area falls through to the count
::before extended on both sides fails: it takes Delete's edge
no minimum width on the count, narrow count at the 12px UI font fails: Next takes Previous's inner edge
no block margins, 200% Interface Scale at the 12px UI font fails: Previous takes the lower edge of an action button on the row above
this branch passes

Pixel comparisons against the merge base in the test fixture (375px, en):

  • Idle footer at UI font scales 0.75, 0.9375 and 1.25, animations finished: identical.
  • Keyboard focus on Previous: identical. The earlier version of this PR drew a 24px ring shifted toward and over the count.

Nothing on screen moves. Only the area that accepts a press grows.

…x slot

#12735 shrank .aui-branch-chevron-btn from 24x32 to 20x20 to make the chevrons read
as part of the count. That dropped them under the 24px every footer control keeps
since #12173, which playwright_user_message_time.py checks, so 'Frontend build +
bundle sanity' fails on main once its earlier steps pass (#12770, #12772).

Size the button 24px and take the extra 4px back with a -2px margin. Every footer
element stays where it was and the glyph centres do not move; only the clickable
area grows, and with no hover fill it is not visible.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T01:22:24.731597Z b38a688 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: f8357530d0

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

Comment thread studio/frontend/src/index.css Outdated
@apply inline-flex size-[calc(20px*var(--ui-space-scale,1))] shrink-0 cursor-pointer items-center justify-center rounded-full p-0 text-chat-icon-fg transition-colors hover:text-black active:text-black dark:hover:text-white dark:active:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-30 disabled:hover:text-chat-icon-fg dark:disabled:hover:text-chat-icon-fg;
/* A 24px hit target (the size #12173 guarantees every footer control) in the 20px slot the layout was
tuned to: the -2px margin gives the extra 4px back, so nothing moves and there is no fill to show it. */
@apply inline-flex -m-[calc(2px*var(--ui-space-scale,1))] size-[calc(24px*var(--ui-space-scale,1))] shrink-0 cursor-pointer items-center justify-center rounded-full p-0 text-chat-icon-fg transition-colors hover:text-black active:text-black dark:hover:text-white dark:active:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-30 disabled:hover:text-chat-icon-fg dark:disabled:hover:text-chat-icon-fg;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Clamp the chevron hit target to at least 24px

Because both the size and margin are multiplied by --ui-space-scale, this still violates the 24px guarantee for supported smaller UI settings. For example, the minimum 12px UI font sets the spacing scale to 0.8, producing a 19.2px button; browser interface scales below 100% shrink it further. The existing layout test only exercises the default and enlarged spacing scales, so it passes without covering this case. Keep the visual slot scaled if desired, but clamp the actual button box to a 24px minimum.

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: at the 12px UI font size --ui-space-scale is 0.8, and the scaled target came out at 19.2px. Fixed in 77caffb: the size is now max(24px, the scaled 20px slot), and the margin hands back the difference, so the slot and glyph centres still follow the scale (checked at 12, 14 and 20px, centres unchanged) while the hit area never drops below 24px. The browser check now includes the 12px layout; with the previous commit it fails there at width 19.19.

…e scale

24px * --ui-space-scale fell to 19.2px at the 12px UI font size (scale 0.8). Size
the target as max(24px, the scaled 20px slot) and hand the difference back with the
margin, so the slot and the glyph centre still follow the scale while the hit area
never drops under 24px. Add the 12px layout to playwright_user_message_time.py,
which only covered 15px and 20px and so could not see it.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 5, 2026
@danielhanchen

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: 77caffb964

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

Comment thread studio/frontend/src/index.css Outdated
--aui-chevron-hit: max(24px, var(--aui-chevron-slot));
width: var(--aui-chevron-hit);
height: var(--aui-chevron-hit);
margin: calc((var(--aui-chevron-slot) - var(--aui-chevron-hit)) / 2);

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 Prevent clamped chevrons from overlapping actions

At the browser's supported 50% Interface Scale setting, --ui-space-scale is 0.5 with the default font, so this creates a 24px button with -7px margins on every side while the production picker has only a 3px left margin. The Previous button therefore overlaps the preceding user-action button by 4px and, because the picker occurs later in the DOM, wins hit testing in that strip, so clicking the edge of More can navigate branches instead. The added test only reaches a 0.8 spacing scale and checks dimensions and viewport bounds, so it cannot detect this pointer-target collision; the 24px target needs to be retained without returning more space than the gap permits.

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.

Right, and it was worse than 50%: at the 12px UI font with 100% Interface Scale the symmetric margin already pushed Previous 2.4px over Delete. Fixed in 294df4e: the extra width now goes only toward the count between the chevrons (not a control), with padding keeping the glyph centre where it was (checked at 12, 15 and 20px), and the floor is 24px times the browser Interface Scale, like browser zoom. The browser check now asserts no two footer controls overlap (as boxes, since large layouts wrap the picker) and covers 50% Interface Scale at 12px; the previous commit fails the overlap check.

… its floor with Interface Scale

The symmetric -extra/2 margin pushed Previous over the Delete/More button beside it:
at the 12px UI font the gap is 1.6px and the extra 8px, and at the browser's 50%
Interface Scale a fixed 24px reached 7px past the slot. In an overlap the later
element wins the click.

Put the extra on the inner side only (toward the count, which is not a control),
with padding keeping the glyph where it was, and make the floor 24px times the
browser Interface Scale, as browser zoom would. The browser check now asserts no
two footer controls overlap and adds the 50% Interface Scale layout; the previous
commit fails the overlap check at 12px.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 294df4ea8d

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

…tton and focus ring stay as drawn

Growing the button itself moved its focus ring: a 24px circle off the glyph's
centre and over the count. The button is back to the 20px slot, scaled; an
invisible positioned ::before carries the extra toward the count, and, being
positioned, paints over the count so presses there reach the chevron (the
previous padding never did: the count, painted later, took them).

The layout check now measures each control's real target by hit testing the
middle of every edge, and requires the chevron's own box to stay square and
unpadded so the ring stays centred on the glyph.
@danielhanchen

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: e043fff2b8

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

Comment on lines +2415 to +2418
inset-inline-end: calc(var(--aui-chevron-extra) * -1);
}
.aui-branch-chevron-btn:last-child::before {
inset-inline-start: calc(var(--aui-chevron-extra) * -1);

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 Reserve count space before extending both chevrons

When the minimum UI font size is combined with a narrow custom chat font, each pseudo-element extends 8px toward the count, but the count has no corresponding 16px minimum width. Studio permits arbitrary imported chat fonts, so a short value such as 1/2 can be narrower than the combined extensions; the two hit targets then overlap, and the later Next button wins hit testing on part of Previous. The fixture's font-mono count is wide enough to hide this case, so reserve sufficient count width or otherwise prevent the inward extensions from meeting.

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, the fixture's monospace count hid it. Fixed in 0a5aa6a: the count between the chevrons now has a minimum width of both extensions plus 1px (the slack keeps touching targets from trading a sub-pixel once snapped), with its text centred, so a wider count, the usual case, is unchanged (pixel comparisons against the merge base at UI font scales 0.75, 0.9375 and 1.25, idle and focused, are identical). The layout check gains a narrow-count layout at the 12px UI font; removing the minimum width fails it with Next taking Previous's inner edge.

…ions

In a narrow custom chat font a short count such as 1/2 can be narrower than
the two ::before extensions together, and Next would then win presses on the
inner edge of Previous. The count now has a minimum width of both extensions
plus 1px, centred; any count wider than that, the usual case, is untouched.
The layout check gains a narrow-count layout at the smallest UI font.
@danielhanchen

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: 0a5aa6ab81

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

.aui-branch-chevron-btn::before {
content: "";
position: absolute;
inset-block: calc(var(--aui-chevron-extra) / -2);

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 Reserve vertical room for expanded chevrons

At the supported 12px UI font and 200% Interface Scale, --ui-space-scale is 1.6, so the chevron box is 32px but this pseudo-element extends 8px above and below it to form a 48px target. In a narrow viewport the action controls and branch picker wrap onto separate lines, while UserMessageFooter provides only a scaled gap-y-1 (6.4px), causing each chevron target to overlap the preceding action row by 1.6px; because the picker is later in the DOM, clicking the lower edge of an action can navigate branches instead. The layout matrix only exercises 50% Interface Scale, so it misses this supported maximum-scale case; reserve enough cross-axis space whenever the picker wraps.

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. Fixed in b38a688: the chevrons carry block margins of half the extra, so the space above and below the box that the target covers is reserved in layout. In one row with the action buttons that fits inside the row's height and nothing moves (the 0.75 UI font scale footer is pixel-identical to the merge base, and at larger font scales the extra is smaller or zero); when the picker wraps onto its own row, that row grows to hold its targets instead of reaching across the gap. The layout check gains 200% Interface Scale layouts at 375 and 320px at the 12px UI font; the previous head fails them with Previous taking the lower edge of an action button.

At 200% Interface Scale and the 12px UI font the target reaches 8px past the
box on each side, more than the footer's 6.4px row gap, so once the picker
wrapped onto its own row it took the lower edge of the action buttons above.
The chevrons now carry block margins of half the extra: inside one row with
the actions they fit in the row's height and nothing moves; a wrapped picker
row grows to hold its targets. The layout check gains 200% layouts at 375 and
320px; the previous head fails them.
@danielhanchen
danielhanchen force-pushed the ci-branch-chevron-target branch from 9184edc to b38a688 Compare October 6, 2026 01:20
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: b38a688833

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

@danielhanchen
danielhanchen merged commit bb30cc9 into main Oct 6, 2026
@danielhanchen
danielhanchen deleted the ci-branch-chevron-target branch October 6, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant