Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Combobox]: Acess isOpen/isExpanded #592

Closed
CodingDive opened this issue May 19, 2020 · 0 comments
Closed

[Combobox]: Acess isOpen/isExpanded #592

CodingDive opened this issue May 19, 2020 · 0 comments

Comments

@CodingDive
Copy link
Contributor

🚀 Feature request

I'd love to be able to access the isExpanded state of the Combobox.

Current Behavior

There is no way to access it other than reading data-attributes[data-reach-combobox-popover] in the DOM. (WRONG)

Suggested Solution

Expose the read-only prop by hook or render prop.

Who does this impact? Who is this for?

Everyone who wants to use the state.

In my example, I would sometimes want to resort or change the list data after a Combobox item was selected. I only want to update the list when it's closed otherwise it'd lead to some twitter-like UX 😁

It would also allow me to work around #395 by only changing state in the onDismiss prop of the Dialog when the Combobox is expanded. This would probably still mess up the focusing because of the unmount/remount but it'd be something.

Describe alternatives you've considered

Checking data-attributes.

Actual solution

While writing this issue, I found the useComboboxContext hook in the docs that already exposes isExpanded 🤦‍♂️

I decided to post it anyhow to cross-reference and in the hope, it may be useful to someone.

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

No branches or pull requests

1 participant