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.

Show dropdown on focus

See original GitHub issue

Right now, there is no focus event bound. That means that if the user types a few characters and then blurs the field, returning to the field does not show the dropdown again.

This may make sense for some uses, but the option to show the dropdown on focus is actually useful in two cases:

  • Allow resuming selection if blurred without needing to type another character.
  • Allow setting data-minchars="0" to show the options without anything having been typed yet.

I can submit a PR if you’re interested.

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
fractaledmindcommented, Nov 22, 2015

FWIW, you can easily accomplish this behavior with the evalutate method along with setting the minChars value to 0. Using some simple jQuery:

var awesomplete = new Awesomplete(document.getElementById('awesomplete'), {
  minChars: 0
});
$('#awesomplete').on('focus', function() {
  awesomplete.evaluate();
});
0reactions
dimitriskdcommented, Jul 9, 2022

FWIW, you can easily accomplish this behavior with the evalutate method along with setting the minChars value to 0. Using some simple jQuery:

var awesomplete = new Awesomplete(document.getElementById('awesomplete'), {
  minChars: 0
});
$('#awesomplete').on('focus', function() {
  awesomplete.evaluate();
});

how could we do that if we wanted to do this behavior on each element with the class awesomplete?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proper way to show drop down on focus with CSS
I'm trying to make a keyboard accessible menu but I can't figure out how to get it to show the the drop down...
Read more >
CSS focus powered dropdown menu - Daily Dev Tips
A complete CSS-powered dropdown menu! No JavaScript required! We will use a button with a focus state. We'll check if we need to...
Read more >
Drop down Menu via CSS :focus - CodePen
URL Extension Required​​ css , . js , or the extension of a matching code processor.
Read more >
How to set the focus on drop-down list automatically when the ...
The <select> autofocus attribute is a boolean attribute that specifies that the drop-down list should automatically get focus when the page ...
Read more >
Open the DropDown When the Control Gets Focus
RadComboBox's API gives you the ability to open the DropDown when the control gets focus. In order to enable this behavior you should...
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