Add DocSearch button key theme styles for light and dark modes#8076
Add DocSearch button key theme styles for light and dark modes#8076Deven14125 wants to merge 3 commits intowebpack:mainfrom
Conversation
Introduce .DocSearch-Button-Key styles for light and dark themes: apply text, background, and border colors using Tailwind @apply with important modifiers. The dark variant targets [data-theme="dark"] to ensure search key tokens are visible and consistent across themes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds theme-aware styling for the DocSearch “key” UI so it looks consistent in light/dark modes.
Changes:
- Introduces base styles for
.DocSearch-Button-Key(text/background/border). - Adds a dark-theme override for
.DocSearch-Button-Keywhen[data-theme="dark"]is active.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/styles/tailwind.css
Outdated
| @apply text-gray-700! bg-gray-100! border-gray-300!; | ||
| } | ||
| [data-theme="dark"] .DocSearch-Button-Key { | ||
| @apply text-gray-100! bg-olive-700! border-gray-500!; |
There was a problem hiding this comment.
bg-olive-700 doesn’t appear to be a defined Tailwind color in this repo (tailwind.config.js only defines blue/gray/white/black/transparent). In dark mode this means the background utility won’t be generated, so the key can end up with text-gray-100 on the inherited light bg-gray-100 (very low contrast). Use an existing color token (e.g. one of the configured grays/blues) or extend the Tailwind theme to include olive shades before using bg-olive-700.
| @apply text-gray-100! bg-olive-700! border-gray-500!; | |
| @apply text-gray-100! bg-gray-700! border-gray-500!; |
src/styles/tailwind.css
Outdated
| @apply text-gray-700! bg-gray-100! border-gray-300!; | ||
| } | ||
| [data-theme="dark"] .DocSearch-Button-Key { | ||
| @apply text-gray-100! bg-olive-700! border-gray-500!; | ||
| } |
There was a problem hiding this comment.
This file already uses the custom dark variant via dark: utilities (e.g. .DocSearch-Button-Placeholder uses lg:dark:text-gray-300!), but here dark mode is handled with a separate [data-theme="dark"] .DocSearch-Button-Key selector. Consider folding the dark styles into the base rule with dark: utilities to keep the pattern consistent and reduce duplicated selectors.
| @apply text-gray-700! bg-gray-100! border-gray-300!; | |
| } | |
| [data-theme="dark"] .DocSearch-Button-Key { | |
| @apply text-gray-100! bg-olive-700! border-gray-500!; | |
| } | |
| @apply text-gray-700! bg-gray-100! border-gray-300! dark:text-gray-100! dark:bg-olive-700! dark:border-gray-500!; | |
| } |
alexander-akait
left a comment
There was a problem hiding this comment.
Fix this problems and never ignore the PR template
Merge the separate [data-theme="dark"] rule into the main .DocSearch-Button-Key selector by using Tailwind's dark: utilities. This consolidates light and dark styles into one rule and changes the dark background from bg-olive-700 to bg-gray-700 for consistency.
|
I Fixed the Problem , now you can review it. |
|
Black on black, looks bad, to see - go to https://webpack-js-org-git-fork-deven14125-fix-search-icon-color-openjs.vercel.app/, enabled dark mode and click on search and you will see black on black |
Change .DocSearch-Button-Key dark mode background from gray-700 to blue-400 in src/styles/tailwind.css to adjust the button appearance in dark theme (improves visibility/brand consistency).
|
Thanks for pointing this out! Previously, the DocSearch key wasn’t adapting well to dark mode, so I adjusted the background styling. I’ve now updated it to use Please take another look and let me know if this works better or if any further adjustments are needed. |
Description
This PR introduces theme-aware styling for the DocSearch button key to ensure consistent appearance across light and dark modes.
Changes Made
.DocSearch-Button-Keydark:utilitiesBefore
The DocSearch button key did not adapt correctly to theme changes, resulting in inconsistent UI appearance.
After
The component now properly responds to theme changes, ensuring a consistent and polished user experience.
Checklist