Repository navigation
fix(studio): keep the phone icon size for Buttons inside asChild triggers - #2368
Merged
Merged
Conversation
Measure the drawn icon of a Button inside a TooltipTrigger (learning refresh) and a DropdownMenuTrigger (schedule actions, chat options) at 1280px and 390px. On phones the bare glyphs inside a DropdownMenuTrigger draw at 18px because the trigger's data-slot replaces the Button's and the phone rule misses them; the refresh icon holds 20px only through its per-site size-4. Refs #2366 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…gers A Radix trigger with asChild passes its own data-slot through props, and Button spreads props after its data-slot="button", so the trigger's slot wins. The phone rule in styles.css keyed on [data-slot="button"] and missed every Button inside a TooltipTrigger or DropdownMenuTrigger: their bare glyphs drew at 18px on phones instead of 20px. Button now also sets data-button after the spread, so no merged prop can replace it, and the phone rule keys on [data-button]. data-slot keeps naming the outermost part, as the trigger tests expect. - Remove the size-4 workaround on the learning refresh icon. - The learning pin reads the phone rule's selector list from styles.css instead of a copied string literal. - The browser journeys now expect 20px on phones for all three triggers. Closes #2366 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
kantord
approved these changes
Oct 16, 2026
kantord
left a comment
Member
There was a problem hiding this comment.
Thanks for fixing this at the root rather than per call site. Putting data-button after the props spread is the right shape: data-slot keeps naming the outermost part, and the phone rule no longer depends on whether a trigger replaced it. I also checked that nothing else in apps/ keys on [data-slot="button"] (only styles.css, button.tsx and fonts.test.ts, all updated here). Approving, with a few non-blocking notes:
- Heads-up for whoever tests on a phone: every bare icon in a Button inside an
asChildtrigger now draws at 20px instead of 18px. That is the intent, but it is a visible change across the app. - Elements that only borrow
buttonVariantsclasses, andToggle, still don't getdata-button, so they still needsize-4per icon (#2362 does this). A one-line note in the PR or the code comment would help the next reader. - The new Playwright spec has three journeys with heavy mock setup for behaviour the unit tests already pin. Not a correctness issue, just maintenance cost.
Fully or partially written by an AI agent.
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On phones, Studio draws every Button icon at 20px through a rule in
apps/web/src/styles.csskeyed on[data-slot="button"]. A Button inside a Radix trigger withasChild(TooltipTrigger,DropdownMenuTrigger, and the Popover, Dialog, AlertDialog, Sheet and Collapsible triggers) loses thatdata-slot, so the rule missed its icon. A bare icon then drew at 18px on phones (Tailwindsize-4is 1rem, and the phone root font size is 18px). #2357 worked around this for one icon withsize-4. This PR fixes the root cause once.Why the Button loses its data-slot
Radix
Slotmerges the trigger's props onto its child element, and the child's own props win. The<Button>element has nodata-slotprop of its own, because Button setsdata-slot="button"inside its render. So the trigger'sdata-slot="tooltip-trigger"arrives in Button'sprops, and Button spreads{...props}after its owndata-slot, which replaces it.The fix, and why this one
Buttonnow also rendersdata-buttonafter the props spread, so no merged prop can replace it. The phone rule keys on[data-button]instead of[data-slot="button"].data-slotkeeps its meaning. It still names the outermost part, as the trigger tests expect (tooltip-trigger,dropdown-menu-trigger). Moving Button'sdata-slotafter the spread would have broken that.[data-slot"-trigger"]) would also catch Select, Tabs and Accordion triggers, which are not Buttons, and would need a new entry for every new trigger primitive.Button asChildaround a link.What changed
components/ui/button.tsx: rendersdata-buttonafter the props spread.styles.css: the phone glyph rule keys on[data-button] svg.lucide.learning-settings-page.tsx: removes thesize-4workaround from refactor(studio): move the learning refresh tooltip to the Tooltip primitive #2357 on the refresh icon.learning-settings-page.pinning.test.tsx: the review nit. The pin no longer copies the phone selector as a string literal. It reads the selector list of the 20px rule fromstyles.css, so a change to the rule changes the pin too. The browser journey below measures the drawn size.Other per-site
size-4iconsfeatures/schedules/schedule-detail.tsxis covered by the root fix: its actions Button inside aDropdownMenuTriggernow draws its icon at 20px on phones (see the screenshots). It is being changed in the open Studio schedules: align the inventory, detail and dialog with the prototype #2299 stack, so this PR does not touch it. Remove itssize-4there later.content-preview-panel.tsx,queued-message-strip.tsxandside-thread-panel.tsxputsize-4on icons inside trigger Buttons. That is the usual explicit icon size used across Studio, not a workaround for this bug, and the first and last are in open PRs (refactor(studio): use the Tabs and Toggle primitives in two hand-rolled controls #2334, refactor(studio): use the Toggle primitive in the chat composer area #2362). They are unchanged.Visible change
On phones, the bare icon of a Button inside an
asChildtrigger grows from 18px to 20px, matching every other Button icon. Examples: the chat header's options, and the schedule detail and list actions. Desktop is unchanged (16px). The learning refresh icon is unchanged at both widths: it held 20px only through its workaround, and now holds it through the shared rule.No regression
test(studio): pin …):e2e/trigger-button-icons.spec.tsmeasures the drawn glyph at 1280px and 390px for a Button inside aTooltipTrigger(learning refresh) and aDropdownMenuTrigger(schedule actions, chat options). On main it passes with the then-current sizes: 16px on desktop for all three; on phones, 20px for refresh and 18px for the two bare icons.fonts.test.tsassertion follows the renamed selector.button.test.tsx:data-buttonis present on a plain Button, insideTooltipTrigger asChildandDropdownMenuTrigger asChild(wheredata-slotnames the trigger), and onButton asChild.18 != 20), and so do the learning pin, the fonts test and the Button tests.data-buttonfrom Button fails the three phone journeys.task studio:check: web 189 files / 1619 tests passed, server 27 files / 252 tests passed. Base: 188 / 1616 web, addingbutton.test.tsx(3 tests).task studio:browser: 142 passed, 38 skipped. Base: 136 passed, adding the 6 new journeys.Screenshots
Before is
8cc7c23(main), After is this PR. Red boxes mark changed pixels. There is no Prototype column, because this is a Studio-internal fix.Chat options, 390px light
Schedule detail actions, 390px light and dark
Chat options, 390px dark
Learning refresh (unchanged, workaround removed), 390px and desktop, light and dark
Desktop 1280px, light and dark (unchanged)
Closes #2366
Part of #2201
Part of #2210
🤖 Generated with Claude Code