fix: resolve search dropdown unable to reopen in same session#651
Open
Dhavanesh24cs412 wants to merge 2 commits intoTanStack:mainfrom
Open
fix: resolve search dropdown unable to reopen in same session#651Dhavanesh24cs412 wants to merge 2 commits intoTanStack:mainfrom
Dhavanesh24cs412 wants to merge 2 commits intoTanStack:mainfrom
Conversation
…ck#650) ## Problem The framework and library dropdown menus in the search modal could only be opened once per search session. After the first open-close cycle, subsequent attempts to open the dropdown would fail until the entire search modal was closed and reopened. ## Root Cause The `modal={true}` prop in the Radix Dropdown component creates a modal context that blocks interactions with elements outside the dropdown. This prevented proper state management and focus handling for reopening the dropdown. ## Solution 1. Removed `modal={true}` prop from Dropdown component 2. Removed overly defensive event handlers (onPointerDownOutside, onEscapeKeyDown) 3. Implemented intelligent `onInteractOutside` handler with boundary detection ## Changes - src/components/Dropdown.tsx: Added onInteractOutside with boundary detection - src/components/SearchModal.tsx: Removed modal={true} prop ## Testing ✅ Dropdown opens on first click ✅ Dropdown closes on second click ✅ Dropdown opens again on third click (previously broken - NOW FIXED!) ✅ Multiple open/close cycles work consistently ✅ Keyboard navigation works correctly ✅ Clicking outside dropdown closes it naturally Fixes TanStack#650
👷 Deploy request for tanstack pending review.Visit the deploys page to approve it
|
Author
|
This solution elegantly resolves the dropdown reopening issue by properly managing the modal state through SearchFiltersContext. By removing the blocking modal prop and replacing it with intelligent event handling using onInteractOutside, the dropdown can now be reopened seamlessly within the same session. The DOM boundary detection ensures clicks are correctly attributed. |
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.
Description
Fixes issue #650 where the framework and library dropdown menus in the search modal could only be opened once per search session.
What Changed
modal={true}prop from Dropdown component that was blocking re-opensonInteractOutsidehandlerCloses #650
Testing
Technical Details
Root Cause
The
modal={true}prop in Radix Dropdown creates a modal context that blocks interactions with elements outside the dropdown, preventing proper state management for reopening.Solution
Implemented an intelligent
onInteractOutsidehandler that:[role="listbox"]andbutton[class*="dropdown"]) to intelligently determine boundariesFiles Changed
src/components/Dropdown.tsx: Added onInteractOutside with boundary detectionsrc/components/SearchModal.tsx: Removed modal={true} propWhy This Matters
TanStack Docs search is a critical feature. Users often need to filter by multiple libraries/frameworks in a single search session, making this dropdown reopening capability essential for a smooth user experience.