question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Autocomplete] openOnFocus is not working properly

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 😯

The popup opens even when openOnFocus is set to false which is the default value according to Autocomplete api doc

autocomplete1

But if you focus towards the end of the input, it’s not opening the popup - i.e., working as expected

autocomplete4

Expected Behavior 🤔

The popup should not open when openOnFocus is set to false no matter where the user focuses in the input.

Steps to Reproduce 🕹

https://codesandbox.io/s/gallant-leaf-1u4zg

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

20reactions
AurelienVernaycommented, Jun 4, 2020

useAutomplete.js:868 is responsible of opening the popup, and it doesn’t check openOnFocus value.

It would be cool if handleInputChange checked open state value before opening popup indicator (check here)

I got a workaround by using onMouseDownCapture={(e) => e.stopPropagation()}} on the <Input>, but it would be nice to fix it.

7reactions
sruthisripathicommented, Mar 27, 2020

@sruthisripathi Only a click on the <input> will open the popup. I’m not aware of any alternative.

There is a padding around input field by default due to which you can focus just outside <input> but well inside what appears to be the textbox for autocomplete. If you focus in that padding area the popup opens if openOnFocus is set to true and doesn’t open if openOnFocus is set to false i.e., working as expected. But if you focus inside <input>, the popup’s opening even if you set openOnFocus to false.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Autocomplete] openOnFocus is not working properly #20286
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
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 >
Autocomplete API - Material UI - MUI
Name Type Default options * array renderInput * func autoComplete bool false
Read more >
Autocomplete - Buefy
Autocomplete. Extended input that provide suggestions while the user types. Use with Field to access all functionalities. CodePen. Selected:.
Read more >
Filtering results with tags | Autocomplete - Algolia
Setting openOnFocus to true ensures that the dropdown appears as soon as a user focuses the input. For now, plugins is an empty...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found