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

[useAutocomplete] disableFocusRender prop #374

Closed

Conversation

8BitYoda
Copy link

@8BitYoda 8BitYoda commented Apr 29, 2024

Implements #269

  • disableFocusRender overrides the focus functionality and thus the "groupedoptions" returned via the hook are always populated with a list rather then always an empty array when the input looses focus.

    • This returned list is still filtered depending on the input value and can be empty if there are no matches with the input value.
  • I have followed (at least) the PR section of the contributing guide.

@oliviertassinari oliviertassinari added component: autocomplete This is the name of the generic UI component, not the React module! PR: needs test The pull request can't be merged labels May 24, 2024
@oliviertassinari
Copy link
Member

I don't understand the need for this change. What's missing from https://mui.com/material-ui/react-autocomplete/#githubs-picker?

@martin-slalom
Copy link

martin-slalom commented May 24, 2024

@oliviertassinari So the same issue is happening in this example as well. If you type something into the example you linked then press "tab" to navigate through the options the filtered results "dissappear", reverting back to its unfiltered/empty state. This is because the input no longer has focus.

Clicking on one of the filtered items also causes this revert, what if in my implementation I wanted to select multiple things from that filtered list? You'd have to refilter again.

@oliviertassinari
Copy link
Member

oliviertassinari commented May 24, 2024

I can't reproduce it. It's not/shouldn't possible to tab either to the option.

Screen.Recording.2024-05-24.at.17.05.24.mov

It feels like we should close the issue and the PR as "out of scope".

@martin-slalom
Copy link

martin-slalom commented May 24, 2024

The specific example I was describing was to filter the list so that it produces a subset of items then trying to use "Tab" to select from that list (shown below).

Screen.Recording.2024-05-24.at.11.15.52.AM.mov

Additionally for context, I'm not trying to solve just for the Tab case it's just the easiest way to show that when the input loses focus you also loose your filtered results which a developer/design might not want (in my use-case we didn't). Since this prop is "opt in" it would have no effect on current functionality but rather enhance the hook and give developers more flexibility when designing custom autocompletes.

@oliviertassinari
Copy link
Member

Ok, thanks for the extra information. Moving the conversation back to #269.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! PR: needs test The pull request can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants