🐛 Fix: related projects hover appears dark in light mode#1195
🐛 Fix: related projects hover appears dark in light mode#1195
Conversation
Replaced Tailwind dark:hover:bg-gray-800 class on project links with explicit React hover state (onMouseEnter/onMouseLeave). Background colors are now determined programmatically based on the resolved theme, preventing Tailwind dark: variants from bleeding into light mode when the html.dark class is still present during hydration. Also tracks hovered item by project title key to correctly apply and reset hover styles without relying on CSS class selectors. Signed-off-by: btwshivam <shivam200446@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellar-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Welcome to KubeStellar! 🚀 Thank you for submitting this Pull Request. Before your PR can be merged, please ensure: ✅ DCO Sign-off - All commits must be signed off with ✅ PR Title - Must start with an emoji: ✨ (feature), 🐛 (bug fix), 📖 (docs), 🌱 (infra/tests), Getting Started with KubeStellar: Contributor Resources:
🌟 Help KubeStellar Grow - We Need Adopters! Our roadmap is driven entirely by adopter feedback. Whether you're using KubeStellar yourself or know someone who could benefit from multi-cluster Kubernetes: 📋 Take our Multi-Cluster Survey - Share your use cases and help shape our direction! A maintainer will review your PR soon. Feel free to ask questions in the comments or on Slack! |
There was a problem hiding this comment.
Pull request overview
This PR fixes a visual bug where hover effects on related project links appeared with dark mode styling in light mode due to Tailwind's dark: variants being applied during hydration before the theme was fully resolved. The fix replaces CSS-based hover styling with React state management and programmatic background color determination based on the resolved theme.
Changes:
- Replaced Tailwind
dark:hover:bg-gray-800class with React state-based hover tracking - Added programmatic background color determination based on
isDarktheme state - Implemented
onMouseEnter/onMouseLeavehandlers to manage hover state explicitly
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
clubanderson
left a comment
There was a problem hiding this comment.
1194 🐛 Fix: dark mode switch button appears dark in light mode btwshivam
1190 🐛 Fix: resolve hydration mismatch in RelatedProjects links oksaumya
oh yep updated |
clubanderson
left a comment
There was a problem hiding this comment.
Review
The hover fix works — using React state with onMouseEnter/onMouseLeave prevents the Tailwind dark:hover: class from applying incorrectly during hydration.
Notes:
- Unrelated reformatting of Moon/Sun className template literals and
isProductionindentation adds noise to the diff. - This PR conflicts with #1190 (both modify
RelatedProjects.tsx). Merge #1190 first, then rebase this one. - Same broader concern as #1194: replacing CSS hover with JS hover state works but is less idiomatic. A theme initialization script that sets
html.darkbefore paint would be the root-cause fix, allowing Tailwinddark:classes to work reliably.
/lgtm
|
LGTM label has been added. DetailsGit tree hash: 10351d76ef23baa5cf813b33b673a63bb3fe4b06 |
|
@copilot This PR now has merge conflicts because #1190 was merged first (both modify
|
|
@clubanderson I've opened a new pull request, #1202, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Replaced Tailwind dark:hover:bg-gray-800 class on project links with explicit React hover state (onMouseEnter/onMouseLeave). Background colors are now determined programmatically based on the resolved theme, preventing Tailwind dark: variants from bleeding into light mode when the html.dark class is still present during hydration.
Also tracks hovered item by project title key to correctly apply and reset hover styles without relying on CSS class selectors.
📌 Fixes
Fixes #1193
📝 Summary of Changes
Changes Made
Checklist
Please ensure the following before submitting your PR:
Screenshots or Logs (if applicable)
👀 Reviewer Notes
Add any special notes for the reviewer here