-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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] Breaks full width of TextField inside flex containers #20145
Comments
The problem is that |
@Cristy94 I'm completely aware of this. But it feels a bit weird that I have to manually add styles to something. I also wonder why |
@levrik It's required per https://www.w3.org/TR/wai-aria-practices/#combobox. But they are working on removing the container: https://github.com/w3c/aria/wiki/Resolving-ARIA-1.1-Combobox-Issues#aria-11-problems. I'm not sure it's stable enough yet. @eps1lon What do you think, should we follow this draft or delay things? w3c/aria#1051
This is an interesting concern, I have been wondering about this problem lately: #19805. diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
index 0c3181850..c65ba60be 100644
--- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
+++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
@@ -20,6 +20,10 @@ export const styles = theme => ({
visibility: 'visible',
},
},
+ /* Styles applied to the root element if `fullWidth={true}`. */
+ fullWidth: {
+ width: '100%',
+ },
/* Pseudo-class applied to the root element if focused. */
focused: {},
/* Styles applied to the tag elements, e.g. the chips. */
@@ -376,6 +380,7 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) {
classes.root,
{
[classes.focused]: focused,
+ [classes.fullWidth]: fullWidth,
[classes.hasClearIcon]: hasClearIcon,
[classes.hasPopupIcon]: hasPopupIcon,
}, |
Adding |
I wouldn't touch anything combobox related right now without actually verifying it with assistive technology. If I remember correctly then ARIA 1.2 and 1.3 will have an updated version of the combobox pattern. |
First of all, I'm new here. I hope can help the material-ui community
@Cristy94 and @oliviertassinari I tried to remove this extra div and the behavior still the same seemingly, I did a few tests. Someone who has a good background about Material-UI, why need this extra div, have something special that I'm not seeing? |
@igorbrasileiro It's required per https://www.w3.org/TR/wai-aria-practices/#combobox. |
Current Behavior 😯
As you can see in the example linked below, setting
fullWidth
on anTextField
supplied toAutocomplete
doesn't take the full width anymore as soon as theAutocomplete
is wrapped inside a flex container.Expected Behavior 🤔
That it takes the full width inside a flex container like a raw
TextField
does.Steps to Reproduce 🕹
See https://codesandbox.io/s/trusting-bassi-7dtc1
Context 🔦
Your Environment 🌎
The text was updated successfully, but these errors were encountered: