Closed NarendraKuruva closed 3 days ago
This looks like it was intentional so it is behaving as expected but perhaps we can consider opening it up so that it will display "No Result" even when not async. However, I think it might require some additional changes since we'd have to keep the Popover
open to display this result when currently we close it when there are no matches. I'm not too familiar with this component though so not sure if that's something we'd like or not, perhaps the team will have other thoughts.
In addition to the code section @yihuiliao provided, https://github.com/adobe/react-spectrum/blob/f8d63a6464273c2d525b5ea949b7a7ccf2c7a187/packages/%40react-spectrum/combobox/src/ComboBox.tsx#L107 would need to be set to true
in all cases not just async to enable this behavior. For some more background, this behavior was originally added to the async specifically because we encountered iffy behavior when the user's filter text went from "doesn't match any results" to "matching results" after the async fetch finished. Ideally, we imagined that the menu would simply reopen if new results matching your filter text were loaded, but https://github.com/adobe/react-spectrum/issues/5234 has some more details about the difficulties around this.
I don't recall any issues with making the "No items" view appear in the React Spectrum combobox but we'd have to check with design to ok that change on the RSP side. I believe you can replicate this behavior with the React Aria Components Combobox since it accepts the "allowsEmptyCollection" props and would recommend you switch to using that instead if at all possible so you have more control over your api and don't have to untangle yourself from the Spectrum specific behavior
Got it Thank you @LFDanLu @yihuiliao
Provide a general summary of the issue here
In
Combobox
no items text is not displayed when no matching options for the search text match.Below video shows no items text not displaying in combobox![Peek 2024-06-25 18-42](https://github.com/adobe/react-spectrum/assets/102137869/c9eed6a3-c0c2-4e8a-b663-28df93edcea5)
Whereas it is being shown in async list combobox example. Below gif shows no items text being displaying in async combobox example![Peek 2024-06-25 18-44](https://github.com/adobe/react-spectrum/assets/102137869/49bfc45c-1a67-416f-8970-4f5622376cc5)
π€ Expected Behavior?
No Items view/ no data text should be displayed when there are no items that match the search text
π― Current Behavior
Not getting no items text when no matching options for the search text match.
π Possible Solution
No response
π¦ Context
No response
π₯οΈ Steps to Reproduce
Version
Not using react spectrum. Using components by directly copying
What browsers are you seeing the problem on?
Chrome
If other, please specify.
Using specific nested packages
What operating system are you using?
Ubuntu 22.04.4 LTS
π§’ Your Company/Team
No response
π· Tracking Issue
No response