Skip to content

Fix search input clear button and hint container positioning#194

Merged
fabiankaegy merged 8 commits intomainfrom
fix/search-input-css
Apr 8, 2026
Merged

Fix search input clear button and hint container positioning#194
fabiankaegy merged 8 commits intomainfrom
fix/search-input-css

Conversation

@claytoncollie
Copy link
Copy Markdown
Contributor

Summary

  • Override third-party @easyops-cn/docusaurus-search-local styles to properly position the clear button (absolute, right-aligned at 7px) and keyboard shortcut hint container (absolute, right-aligned at 10px) inside the navbar search input
  • Remove fragile exact-match searchHintContainer selector in favor of existing robust [class^="searchHintContainer_"] prefix selector in homepage-components.css

Test plan

  • Verify the search clear button appears inside the input, right-aligned
  • Verify the keyboard shortcut hint is right-aligned inside the input
  • Verify the hero banner search still hides the hint container

Override third-party search plugin styles to properly position the
clear button and keyboard shortcut hint inside the search input.
Remove fragile exact-match searchHintContainer selector.
@claytoncollie claytoncollie self-assigned this Apr 8, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

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

Project Deployment Actions Updated (UTC)
10up-gutenberg-best-practices Ready Ready Preview, Comment Apr 8, 2026 10:06am

Scope clear button and hint container selectors under .navbar__search
to beat the package's CSS module specificity and cascade order.
The package selector uses two classes (0,2,0), so our override needs
three classes (0,3,0) to win regardless of cascade order.
Specificity alone can't reliably beat the third-party package styles
due to unpredictable cascade order. Use !important to guarantee
our overrides apply.
The element may have multiple classes, so [class^=] fails when
searchClearButton_ isn't the first class in the attribute.
@fabiankaegy fabiankaegy merged commit 841dd8f into main Apr 8, 2026
7 checks passed
@fabiankaegy fabiankaegy deleted the fix/search-input-css branch April 8, 2026 12:47
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.

2 participants