Skip to content

React Aria ComboBox filters items but docs state it doesn't #10065

@simonhermann

Description

@simonhermann

Provide a general summary of the issue here

React Aria Combobox Docs state there is no default for defaultFilter, but there actually seems to be the "contains" filter set.
FYI, in our case fuzzy filtering happens in backend, so always want to show all suggestions.

🤔 Expected Behavior?

There should not be any filter set by default and/or the Docs need to reflect actual behaviour.

😯 Current Behavior

Assuming we have example from the Docs, but we chainge the content of the first item to "A_ardvark" instead of "Aardvark".

     <ComboBox
        label="Animal"
        placeholder="e.g. Cat"
        name="animal"
        isRequired
        description="Please select an animal.">
        <ComboBoxItem id="aardvark">Aardvark</ComboBoxItem>
        <ComboBoxItem id="cat">Cat</ComboBoxItem>
        <ComboBoxItem id="dog">Dog</ComboBoxItem>
        <ComboBoxItem id="kangaroo">_Kangaroo</ComboBoxItem>
        <ComboBoxItem id="panda">Panda</ComboBoxItem>
        <ComboBoxItem id="snake">Snake</ComboBoxItem>
      </ComboBox>

When typing "aa" in the combobox, the suggestions does not show up.

Overriding with defaultFilter={undefined} does not change that (iMO it should), but defaultFilter={()=>true} fixes it, all suggestions are rendered.

💁 Possible Solution

Either don't set a defaultFilter or if doing so, document that and make it overridable by setting undefined.

🔦 Context

No response

🖥️ Steps to Reproduce

  1. Open Example in Stackblitz
  2. change <ComboBoxItem id="aardvark">Aardvark</ComboBoxItem> to <ComboBoxItem id="aardvark">A_ardvark</ComboBoxItem>
  3. type "aa" in the Combobox

Version

1.16.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

MacOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions