fix: restore AA contrast on download button hover states - #31
fix: restore AA contrast on download button hover states#31AmrendraTheCoder wants to merge 1 commit into
Conversation
The Windows and Linux buttons pass variant="outline", which contributes hover:text-accent-foreground. The inline className overrides the hover background but never declares a hover:text-*, so tailwind-merge keeps the variant's hover text colour. On hover the label was therefore drawn in accent-foreground over gray-800/gray-200. Measured with the WCAG 2.1 relative-luminance formula: light #020817 on #1f2937 -> 1.36:1 dark #ffffff on #e5e7eb -> 1.24:1 Both are far below the 4.5:1 required for normal text, leaving the label almost invisible. The Mac button uses the default variant and so was never affected, which matches the report naming only Windows and Linux. Declare the hover text colour explicitly so it overrides the variant and matches the resting state: light #ffffff on #1f2937 -> 14.68:1 dark #000000 on #e5e7eb -> 16.96:1 Applied to all three buttons so their class lists stay identical.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThe Mac, Windows, and Linux download buttons now define explicit hover text colors for light and dark modes. No functional behavior changed. ChangesDownload button hover contrast
Estimated code review effort: 1 (Trivial) | ~3 minutes Merge Risk: ⚪ Minimal · up to This localized change restores accessible hover-text contrast on the affected download buttons without changing resting-state behavior; no actionable merge-blocking risk remains after normal checks and review. Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Link your account with GitcordThanks for opening this PR, @AmrendraTheCoder! To receive Discord notifications and contributor tracking for this organization:
Once linked, Gitcord can notify you about reviews, merges, and more. — Posted by Gitcord |
Addressed Issues:
Fixes #3
Screenshots/Recordings:
The defect is a colour-contrast ratio, so measured numbers are more precise than a screenshot. Measured with the WCAG 2.1 relative-luminance formula against the running dev server:
#1f2937(gray-800)#020817→ white#ffffff#e5e7eb(gray-200)#ffffff→ black#000000Reproducible in DevTools on the running site:
Additional Notes:
Root cause, and why only two of the three buttons. All three download buttons in
src/Pages/pictopy-landing.tsxshare an identicalclassName, but Windows and Linux additionally passvariant="outline". That variant contributeshover:text-accent-foreground. The inlineclassNameoverrides the hover background (hover:bg-gray-800,dark:hover:bg-gray-200) but never declares ahover:text-*, so tailwind-merge has nothing to override the variant with and keepsaccent-foregroundas the hover text colour.The result is the label being drawn in near-background colour on hover. 1.36:1 and 1.24:1 are closer to invisible than merely low. The Mac button uses the default variant and keeps its white/black label, which is exactly why the report names only Windows and Linux.
The fix. Declare the hover text colour explicitly so it overrides the variant and matches the resting state:
Applied to all three buttons so their class lists stay identical. Mac is behaviourally unchanged (it was already white-on-dark), but keeping the three in sync avoids the next person reintroducing the same divergence.
Verification.
npm run buildpasses.npm run lintreports the same 2 errors and 3 warnings asmain, all inHome1.tsx,input.tsxandtheme-provider.tsx, none in the file I touched. No visual change to the resting state.Deliberately out of scope.
variant="outline"now contributes nothing to these buttons: the inline classes override its background, its border and its hover text. Removing it would be the deeper cleanup and would make all three buttons consistent, but that is a wider change than this issue asks for and I would rather a maintainer make that call. Happy to follow up in a separate PR.Checklist
AI Usage
Per AOSSIE's AI Usage Policy: I used Claude (Opus) to help trace the tailwind-merge precedence behaviour and draft the fix. I measured the contrast ratios myself against the running site, before and after, and verified that
hover:text-accent-foregroundis no longer present on any of the three buttons.Summary by CodeRabbit