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

[Autocomplete] Virtualized with grouped items #18597

Closed
1 task done
Janpot opened this issue Nov 27, 2019 · 9 comments · Fixed by #18763
Closed
1 task done

[Autocomplete] Virtualized with grouped items #18597

Janpot opened this issue Nov 27, 2019 · 9 comments · Fixed by #18763
Labels
component: autocomplete This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process. new feature New feature or request

Comments

@Janpot
Copy link
Member

Janpot commented Nov 27, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

I'm trying to add grouping to the virtualized autocomplete example. But it seems like the List that is virtualized is comprised of one child per group instead of one child per option. Would it be possible to implement the grouped autocomplete as a flat list of items+subheaders instead.

I've kind of started looking into it with renderGroup but it's not working well yet. a pair of extra eyes would be helpful as well. It seems to me this should be possible to support out of the box.

Examples 🌈

https://material-ui.com/components/autocomplete/#virtualization
https://material-ui.com/components/autocomplete/#grouped

@oliviertassinari oliviertassinari added component: autocomplete This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process. labels Nov 27, 2019
@oliviertassinari
Copy link
Member

@Janpot It seems that we miss the following style in the component:

diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
index cbf86bdc5..d03350159 100644
--- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
+++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
@@ -135,6 +135,7 @@ export const styles = theme => ({
   /* Styles applied to the option elements. */
   option: {
     minHeight: 48,
+    boxSizing: 'border-box',
     display: 'flex',
     justifyContent: 'flex-start',
     alignItems: 'center',

Given that the virtualization is an advanced demo, I think that we might as well showcase the grouped version: https://codesandbox.io/s/virtualized-grouped-attempt-wm0hi.

@Janpot
Copy link
Member Author

Janpot commented Nov 27, 2019

Given that the virtualization is an advanced demo, I think that we might as well showcase the grouped version

I agree.

Shouldn't that flat implementation of renderGroup be the default? Or is the current implementation (with the nested uls) there for a specific reason?

@oliviertassinari
Copy link
Member

@Janpot Better semantic & accessibility?

@Janpot
Copy link
Member Author

Janpot commented Nov 27, 2019

I don't really care about this much personally, but one thing that seems to not work with your demo is the floating subheaders.

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 27, 2019

@Janpot We have seen many of our users that don't care about accessibility (the majority actually). However, we have a good position to improve it, I think that we should take it.

Sticky position support is a "won't fix" from my perspective (not worth the hassle):

@Janpot
Copy link
Member Author

Janpot commented Nov 27, 2019

Oh no, I care about accessibility, I was talking about the floating subheaders. Hence I agree, not worth the hassle.

@oliviertassinari
Copy link
Member

@Janpot Great 👍

@oliviertassinari oliviertassinari changed the title [Autocomplete] virtualized with grouped items [Autocomplete] Virtualized with grouped items Nov 30, 2019
@oliviertassinari oliviertassinari added the new feature New feature or request label Nov 30, 2019
@oliviertassinari
Copy link
Member

@Janpot Do you want to work on these changes?

@Janpot
Copy link
Member Author

Janpot commented Nov 30, 2019

Not in the foreseeable future. but I'm gonna need it at some point so if nobody has picked it up by then, I will.

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! good first issue Great for first contributions. Enable to learn the contribution process. new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants