[Autocomplete] onOpen callback invoked twice
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 😯
I’m using @material-ui/lab v4.0.0-alpha.36. It seems that onOpen callback of Autocomplete components is getting invoked twice when clicking into field.
Example of the component usage:
<Autocomplete
value={props.value}
options={props.options}
loading={props.loading}
multiple={props.multiple}
renderInput={params => (
<TextField
{...params}
fullWidth
name={props.name}
label={props.label}
onBlur={props.onBlur}
InputProps={{
...params.InputProps,
endAdornment: (
<>
{props.loading ? <CircularProgress color="inherit" size={20} /> : null}
{params.InputProps.endAdornment}
</>
),
}}
/>
)}
onOpen={() => console.log('on open')} <-- this is printed twice
onChange={handleChange}
getOptionLabel={option => option.label}
getOptionSelected={(option, value) => option.value === value}
/>
Expected Behavior 🤔
onOpen callback should be invoked only once.
Steps to Reproduce 🕹
Steps:
- Use Autocomplete component.
- Provide
onOpen
callback. - Click into the field.
- See that
onOpen
invoked twice.
Context 🔦
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.0.0-alpha.36 |
React | v16.12.0 |
Browser | Chrome |
TypeScript | - |
etc. |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:10 (5 by maintainers)
Top Results From Across the Web
[Autocomplete] onOpen callback invoked twice #18891 - GitHub
Current Behavior 😯 It seems that onOpen callback of Autocomplete components is getting invoked twice when clicking into field.
Read more >jquery autocomplete open function getting called twice
The problem I am having is that when I delete the autofilled/autoselected part by pressing delete, the open function runs again for some...
Read more >Autocomplete API - Material UI - MUI
Name Type Default
options * array
renderInput * func
autoComplete bool false
Read more >MUI Autocomplete: How to prevent open on focus, instead ...
Below is a working example of one way to do this. This specifies the onOpen, onClose, onInputChange, open, and inputValue props in addition...
Read more >UIAutocomplete (RichFaces Framework 5.0.0.Alpha2 API)
Javascript code executed when a pointer button is double clicked over this element. String · getOnerror(). The client-side script method to be called...
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
I have added the
waiting for users upvotes
tag. I’m closing the issue as we are not sure it’s important. So please upvote this issue if you are. We will prioritize our effort based on the number of upvotes.Please provide a minimal reproduction test case. This would help a lot 👷 . A live example would be perfect. This codesandbox.io template may be a good starting point. Thank you!