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.

Open options on focus

See original GitHub issue

For context: I am using this component in a form. When clicking a label in a form the expected behavior is that the corresponding input gets the focus. This can be achieved by adding inputProps: {id: 'someId'} to the select component.

Now, using this behavior I need the options menu to open when the component gets focus this way. If I understand the component correctly this is currently not possible. It was a simple change locally but I haven’t made a PR yet, as I’m not even sure if this is behavior you want to support.

(Also somewhat relevant: getting focus by clicking the corresponding label only works if the component is searchable since it doesn’t render an input field to reference if it isn’t. This probably needs its own issue though)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
bhchcommented, Jun 9, 2019

@SachaG

I was able to get it to work with openOnFocus={true}.

I think you meant openMenuOnFocus={true}. openOnFocus is not any option.

3reactions
SachaGcommented, May 4, 2017

Just wanted to say this seems fixed? I was able to get it to work with openOnFocus={true}. I think this is a good option to have because it might not be obvious that there are options to pick from otherwise.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to open option list of HTML select tag on onfocus()
in your code you can place this code select id = "demo2" with this code select id = "demo2" onfocus="myFunction(this) fore highlight your...
Read more >
Use Focus on your iPhone or iPad - Apple Support
Go to Settings > Focus. · Tap the Add button , then tap Custom or browse additional options. · Enter a name for...
Read more >
HTMLElement.focus() - Web APIs | MDN
The HTMLElement.focus() method sets focus on the specified element, if it can be focused. The focused element is the element that will ...
Read more >
Set Focus on <select> Element on Page Load - EncodeDna.com
The <select> element, as you know, provides a menu of options. It's a dropdown list. In many occasions, you might wish to set...
Read more >
Focus option - Unpoly
Pass a CSS selector string to focus a matching element. From JavaScript you may also pass the Element object that should be focused....
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