Skip to content

Add DocSearch button key theme styles for light and dark modes#8076

Open
Deven14125 wants to merge 3 commits intowebpack:mainfrom
Deven14125:fix-search-icon-color
Open

Add DocSearch button key theme styles for light and dark modes#8076
Deven14125 wants to merge 3 commits intowebpack:mainfrom
Deven14125:fix-search-icon-color

Conversation

@Deven14125
Copy link
Contributor

@Deven14125 Deven14125 commented Mar 20, 2026

Description

This PR introduces theme-aware styling for the DocSearch button key to ensure consistent appearance across light and dark modes.

Changes Made

  • Added Tailwind utility styles for .DocSearch-Button-Key
  • Implemented dark mode styles using dark: utilities
  • Improved contrast and accessibility in dark mode

Before

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

  • Code follows project style
  • Dark mode tested
  • No unused styles
  • PR reviewed locally

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.
Copilot AI review requested due to automatic review settings March 20, 2026 04:50
@vercel
Copy link

vercel bot commented Mar 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webpack-js-org Ready Ready Preview, Comment Mar 20, 2026 4:19pm

Request Review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-Key when [data-theme="dark"] is active.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@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!;
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
@apply text-gray-100! bg-olive-700! border-gray-500!;
@apply text-gray-100! bg-gray-700! border-gray-500!;

Copilot uses AI. Check for mistakes.
Comment on lines +51 to +55
@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!;
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
@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!;
}

Copilot uses AI. Check for mistakes.
Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@Deven14125
Copy link
Contributor Author

I Fixed the Problem , now you can review it.

@alexander-akait
Copy link
Member

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).
@Deven14125
Copy link
Contributor Author

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 dark:bg-blue-400, which provides better contrast and improves visibility against the dark UI.

Please take another look and let me know if this works better or if any further adjustments are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants