fix(combobox): re-open menu when async items arrive after empty response (#9823)
* fix(combobox): re-open menu when async controlled items arrive after empty response
When using useComboBox with useAsyncList, if a query returns zero results
the menu closes. A subsequent query that returns results fails to re-open
the menu because the inputValue tracking has already been updated by the
time the async items arrive.
Track when the menu was auto-closed due to an empty controlled collection
and re-open it when items become non-empty while the input is still focused.
Reset the flag on user-initiated closes (blur, Escape, commit) so those
remain permanent.
Fixes #9820
* address review: reset flag on revert, add Escape key test
- Reset closedDueToEmptyControlled in revert() so Escape prevents
re-opening when async items arrive after user dismissal
- Add test for Escape key scenario
- Add onOpenChange assertion for trigger reason on re-open
- Fix minor style: use direct variable instead of destructured object literal
* add component level test
* add a test actually using useAsyncList
* fix(combobox): support re-open for Collection pattern async loading
Remove the `props.items != null` guard so `closedDueToEmpty` is set
unconditionally when the menu auto-closes due to empty collection.
This makes the re-open logic work for both the `items` prop pattern
and the Collection pattern (where items are on ListBox, not ComboBox).
Rename `closedDueToEmptyControlled` to `closedDueToEmpty` to reflect
the broader scope. Add component-level test for the Collection pattern.
* fix lint
* fix tester access
---------
Co-authored-by: Robert Snow <snowystinger@gmail.com>
Co-authored-by: Robert Snow <rsnow@adobe.com>
Co-authored-by: Daniel Lu <dl1644@gmail.com>