[Autocomplete] Requires two clicks to open on mobile ios after state is set
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
When using a controlled autocomplete input, user clicks once to open the menu and selects a value. Then then click off the auto complete to elsewhere on the page. Then the click back on the autocomplete. It does not open. They have to click a second time and then it opens.
Expected Behavior 🤔
When using a controlled autocomplete input, user clicks once to open the menu and selects a value. Then then click off the auto complete to elsewhere on the page. Then the click back on the autocomplete. It opens.
Steps to Reproduce 🕹
https://codesandbox.io/s/romantic-meninsky-kcqgh and here is the code (from autocomplete docs):
/* eslint-disable no-use-before-define */
import React from "react";
import TextField from "@material-ui/core/TextField";
import Autocomplete from "@material-ui/lab/Autocomplete";
const top100Films = [
{ title: "The Shawshank Redemption", year: 1994 },
{ title: "Inglourious Basterds", year: 2009 },
{ title: "Snatch", year: 2000 },
{ title: "3 Idiots", year: 2009 },
{ title: "Monty Python and the Holy Grail", year: 1975 }
];
function Playground() {
const [value, setValue] = React.useState(null);
return (
<div style={{ width: 300 }}>
<Autocomplete
options={top100Films}
openOnFocus
getOptionLabel={option => option.title}
id="controlled-demo"
value={value}
onChange={(event, newValue) => {
setValue(newValue);
}}
renderInput={params => (
<TextField {...params} label="controlled" margin="normal" />
)}
/>
</div>
);
}
export default Playground;
Context 🔦
This will prevent me from using autocomplete componnent due to its effect on mobile users.
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.9.12 |
Material-UI Lab | v4.0.0-alpha.53 |
React | 16.13.1 |
Browser | iOS Safari |
TypeScript | 3.8.3 |
etc. |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (5 by maintainers)
Top Results From Across the Web
[Autocomplete] Requires two clicks to open on mobile ios after ...
When using a controlled autocomplete input, user clicks once to open the menu and selects a value. Then then click off the auto...
Read more >Autocomplete requires you to click twice in iOS after update to ...
After a set time, check to see if the autocomplete results are still visible. If they are, and an item is focussed, trigger...
Read more >Autocomplete: Must click two times to select an item in iOS
First click on an item only sets class "ui-state-focus". Must click it again to actually select it. This worked in version 1.10.0.
Read more >The Annoying Mobile Double-Tap Link Issue - CSS-Tricks
Here's two lines of CSS that will cause the problem But clicking that link will not prevent the link from being visited. On...
Read more >Change AutoFill settings in Safari on Mac - Apple Support
To change these settings, choose Safari > Settings, then click AutoFill. Complete forms with information from any contact card in Contacts. To view...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@joshwooding Awesome. @kaplantm What do you think of this fix? Do you want to work on a pull request? 😃
We already use the fine media query for the date picker with @dmtrKovalenko in https://github.com/mui-org/material-ui-pickers/pull/1653.
@joshwooding Thanks for looking into this so quickly. I’m considering using this component in a project within the next couple weeks. Do you think there will be a quick fix / workaround or should I look into an alternative? Thanks