select: Clear the search query when the menu closes - #3050
Open
Muhammad-Owais-Warsi wants to merge 1 commit into
Open
select: Clear the search query when the menu closes#3050Muhammad-Owais-Warsi wants to merge 1 commit into
Muhammad-Owais-Warsi wants to merge 1 commit into
Conversation
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.
Closes #3047
Description
A searchable
Selectkept its filter query after the menu closed, so the next open showed the old query and a filtered list.clear_queryhad one caller,set_selected_value.Confirm now clears the query after committing and re-resolves the confirmed value via
position(), so the cursor and mark land on the full-list row (a filtered index would point at the wrong item). Cancel clears before restoring the cursor to the committed index. A newclear_query_and_restore_cursorhelper covers every other close: triggerescape(click-out),on_blur, trigger-toggle close, and baseon_open_change. Confirm/cancel clear through the heldlist_statedirectly to avoid re-entering theListStatelock thatdefer_inholds.Screenshot
N/A
Break Changes
None
How to Test
Automated (mirrors the issue's repro: Dutch/English/French/Hungarian, type
hun, close, reopen and navigate):cargo test -p gpui-kit --features="test-support component" --test controls searchable_select
Both tests fail without the fix with the issue's exact signature (
left: Hungarian, right: French) and pass with it. Also ran: full--test controlssuite (6/6 pass),cargo test -p gpui-component select(all pass),cargo fmt --check(clean). Note:cargo clippyreports a pre-existingnonminimal_boollint incrates/base/src/calendar.rs, untouched by this change.Manual: open a
.searchable(true)select, type part of an item name, press Enter (or Escape), reopen — the search field is empty and all items show with the mark on the current item.Checklist
cargo runfor story tests related to the changes.