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.

Select first option on Tab/Enter even when it's not matched for the hint

See original GitHub issue

Version

3.4.5

Steps to reproduce

  1. Go to the examples page
  2. Click in the input field for the first one, the Basic Example.
  3. Type “ask”.
  4. Note that the menu shows two matches: “Alaska” and “Nebraska”.
  5. Hit <kbd>Tab</kbd>.

Expected Behavior

The first option “Alaska” becomes selected since it matches what the user typed.

Actual Behavior

Nothing is selected.

Miscellaneous

At first, I assumed it was caused by my custom menu renderer so I asked on Stack Overflow, but someone pointed out that getHintText() specifically requires the match to be at the start of the label. Perhaps a feature to override this behavior is preferable to changing it for everyone.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dharknesscommented, Jul 6, 2019

FWIW, when I go to google.com, enter a search term, and hit <kbd>Tab</kbd>, the first result does not get selected. Navigating to a result and hitting <kbd>Tab</kbd> also does not select the highlighted result.

Man, I haven’t used Google’s site in forever. 😃 In Chrome at least, typing a domain in your history into the address bar hints the first match in the bar itself. Hitting enter navigates to that URL. I’m fine with only <kbd>Enter</kbd> triggering the navigation, but I don’t think that matters since that’s not how the component is designed to function.

Since I have the options in my state, all I need to do is capture <kbd>Enter</kbd> when the user is in the input. That seems straight-forward enough without actually changing any of the code. Sorry, I got hung up on having to use <kbd>Tab</kbd> originally that I didn’t think of this more obvious solution until just now.

Thanks so much for your help!

0reactions
dharknesscommented, Jul 11, 2019

Good point. 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I select only the first option matching a value using ...
You can use :first selector here which selects the first matched DOM element. $('.countryField').find('option[value="233"]:first').
Read more >
SciFinder (Classic) Guide - Chemistry
If it finds an exact match, it displays only that compound, and no others. For example, if you search for "Gallopamil" it will...
Read more >
Frequently Asked Questions - Galaxy Training!
Click on the User menu at the top and go to Active Interactive Tools and locate the JupyterLab instance you started. Click on...
Read more >
Stickies User Guide for Mac - Apple Support
Learn how to use Stickies on your Mac to keep notes, lists, and even pictures in ... Add a list: Press Option-Tab, enter...
Read more >
Language Options - RAD Studio - Embarcadero DocWiki
Tools > Options > User Interface > Editor > Language and click on Options tab. ... If this option is not checked, you...
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