Skip to content

Conversation

@GhadeerAlbattarni
Copy link
Contributor

Context

This PR fixes an issue where typing a modality option like "US" in the multi-select dropdown would list partial match modalities before the exact match.

Fixes #5534

Problem

The react-select component keeps the original option order for modalities (as defined in filtersMeta.js) and does not prioritize exact matches when filtering.

This default behavior caused unexpected results, for example, typing "US" matched both "US" and "BDUS", but "BDUS" appeared first by default.

Changes

Introduced a controlled inputValue state to track user input.
Used useMemo to sort options in the following order: Exact match, Partial match, Alphabetical fallback
Updated the react-select component to use the sorted list.

Results

The modalities worklist filter prioritize the exact match.

For example, when typing "US":
Before: it will show "BDUS" first and on pressing Enter selects "BDUS"
Screenshot 2025-11-02 at 1 17 38 AM

After: it will show "US" first and on pressing Enter selects "US"
Screenshot 2025-11-02 at 1 17 50 AM

Testing

open Viewer landing page

on modality multi-select filter, type US

confirm that: US appears first in the dropdown list

pressing Enter selects US

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • [] OS:
  • [] Node version:
  • [] Browser:

@netlify
Copy link

netlify bot commented Nov 2, 2025

Deploy Preview for ohif-dev canceled.

Name Link
🔨 Latest commit c300a13
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/6907023eddc020000796344d

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.

[Bug] Modalities drop down lists partial match before exact match

1 participant