fix(swap): sell amount renders at full size, not 14px - #286
Merged
Conversation
On the homepage swap section the amount you type rendered at 14px while the amount you receive rendered at 44px, in the same widget, a few pixels apart. The shadcn Input ships `md:text-sm`. tailwind-merge only evicts a conflicting class within the SAME modifier, so the widget's bare `text-[44px]` replaced `text-base` and left `md:text-sm` standing. Wherever the widget's container was under `@2xl` — the homepage column — nothing outbid it above 768px, and the sell field dropped to 14px. The full-width /swap page hid the bug because `@2xl:text-[56px]` applied there, and phones hid it because `md:` did not. Restating the size under `md:` is what actually evicts it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
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
In the homepage swap section, the amount you type rendered at 14px while the amount you receive rendered at 44px — same widget, a few pixels apart.
Root cause
The shadcn
Inputshipsmd:text-smin its base classes.tailwind-mergeonly evicts a conflicting class within the same modifier, so the widget's baretext-[44px]replacedtext-baseand leftmd:text-smuntouched. Above 768pxmd:text-smthen won wherever nothing else outbid it.That is why it looked fine everywhere I first checked:
/swapfull width@2xl@2xl:text-[56px]outbids → 56px, correct@2xlmd:inactive → 44px, correctRestating the size under
md:is what actually evicts it.Changes
src/app/[locale]/swap/SwapWidget.tsx— addmd:text-[44px]to the sell input, with a comment explaining why it is not redundant with the base size.Test plan
getComputedStyle().fontSizeon the sell input vs the buy display in the homepage swap section, before and after, in a real browser:SELL=14px BUY=44px(md:text-smpresent on the element)SELL=44px BUY=44px(md:text-smevicted)/swappage at 1500 / 1000 / 700px — 56/56, 56/56, 44/44, unchanged by this fix.Inputs given an oversized text class — this was the only one.pnpm lintclean apart from one pre-existing warning inBountiesView.tsx;prettier --checkpasses.Generated with Claude Code