Skip to content

Fix #2989: dcc.Dropdown options order preserved during search#3680

Open
ines-om wants to merge 1 commit intoplotly:devfrom
ines-om:fix-dccDropdown-order
Open

Fix #2989: dcc.Dropdown options order preserved during search#3680
ines-om wants to merge 1 commit intoplotly:devfrom
ines-om:fix-dccDropdown-order

Conversation

@ines-om
Copy link

@ines-om ines-om commented Mar 22, 2026

This PR fixes #2989.

When searching in dcc.Dropdown, search results should be presented in the original option order instead of being reordered by js-search. This is achieved by creating a Set of the search results and filtering the original options array against it, preserving the intended order.

Contributor Checklist

  • I have broken down my PR scope into the following TODO tasks
    • Implement Set-based filtering in DropdownSearch.tsx to preserve user-defined order in search results
    • Add tests for various option ordering scenarios, including ordering in multi-value dropdowns
  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md
  • If this PR needs a follow-up in dash docs, community thread, I have mentioned the relevant URLS as follows
    • this GitHub #PR number updates the dash docs
    • here is the show and tell thread in Plotly Dash community

When searching in dcc.Dropdown, results should maintain the
original option order instead of being reordered by js-search.
By creating a Set of search results and filtering the original
options array, we preserve order while maintaining performance.
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.

dcc.dropdown options order not consistent during search

1 participant