-
-
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] Add scrollbar support in IE11 #19935
Comments
@SergeyUstinovich Thanks for the report. I have no idea on how to fix it. But it seems the page could receive some care from an IE 11 standpoint:
diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
index 612b04d28..1a269cf23 100644
--- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
+++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
@@ -118,6 +118,10 @@ export const styles = theme => ({
flexGrow: 1,
textOverflow: 'ellipsis',
opacity: 0,
+ // Hide IE 11 clear x button
+ '&::-ms-clear': {
+ display: 'none',
+ },
},
/* Styles applied to the input element if tag focused. */
inputFocused: {
diff --git a/packages/material-ui/src/Container/Container.js b/packages/material-ui/src/Container/Container.js
index 95e4dbd93..48374d96a 100644
--- a/packages/material-ui/src/Container/Container.js
+++ b/packages/material-ui/src/Container/Container.js
@@ -11,6 +11,7 @@ export const styles = theme => ({
marginLeft: 'auto',
boxSizing: 'border-box',
marginRight: 'auto',
+ display: 'block', // Fix IE 11 layout when used with main.
paddingLeft: theme.spacing(2),
paddingRight: theme.spacing(2),
[theme.breakpoints.up('sm')]: { What do you think of the following changes? |
@oliviertassinari Thanks for looking at the issue. If the issue is fixed by removing And to be honest I do not care too much about the page layout fix as it's not a priority for me :) |
No, they don't but this should: diff --git a/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js b/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js
index 7dbdc34c9..f77b68bcf 100644
--- a/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js
+++ b/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js
@@ -661,6 +661,12 @@ export default function useAutocomplete(props) {
};
const handleBlur = event => {
+ // Ignore the event when using the scrollbar with IE 11
+ if (document.activeElement === listboxRef.current.parentElement) {
+ inputRef.current.focus();
+ return;
+ }
+
setFocused(false);
firstFocus.current = true;
ignoreFocus.current = false; Can you confirm? Feel free to open a pull request :) (The parent element trick only works because of this constraint #18766) |
IE11: Clicking on scrollbar of opened drop-down closes it.
It works fine in Google Chrome.
Current Behavior 😯
Clicking on scrollbar of opened drop-down closes it.
Expected Behavior 🤔
Clicking on the drop-down scrollbar should keep the drop-down opened and scroll it.
Steps to Reproduce 🕹
The issue exists even on the official website:
https://material-ui.com/components/autocomplete/#sizes
Steps:
arrow down
to open the drop-down with itemsarrow down
of opened drop-down to scroll itemsMy Environment 🌎
The text was updated successfully, but these errors were encountered: