fix(nav): close the site menu when search opens - #526
Merged
Merged
Conversation
The menu is a popover, so the browser draws it above the DocSearch modal. Opening search from the menu left the menu sitting on top of the search box on desktop and mobile. Clicking Search now closes the menu in the same click handler. For Cmd+K and /, DocSearch's onOpen callback fires a docsearch:open event that the menu listens for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Search button lives inside the site menu. The menu is a popover, and browsers draw popovers above everything else on the page. DocSearch adds its modal to the page body, so opening search from the menu left the menu sitting on top of the search box. This happened on desktop and mobile.
Now the menu closes when search opens:
showMobileMenu = falsein the same click handler, like the theme buttons already do. The menu is gone before the search modal's first frame./open search without touching the button, so DocSearch'sonOpencallback now fires adocsearch:openwindow event and the menu listens for it.Things to watch for:
onOpenafter it paints.I tested it in headless Chrome at 1440x900 and 390x844 on the home page and a scrolled docs page, clicking Search and pressing Cmd+K with the menu open. Scroll behaviour is unchanged.
NavigationMobileMenuSearchTestcovers both halves of the wiring and fails without the fix.🤖 Generated with Claude Code