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.

[Dropdown] shouldn’t be firing onChange during the keyboard navigation

See original GitHub issue

Hi,

I have a drop down element (“ui fluid search selection dropdown large elemento_area”) in my page and if the user hits the letter “C” (for example) the dropdown shows a list of possible results that the user can choose. Ok, it works fine and it’s really great. When the user selects some option I use the code below to do my stuff:

                $(".elemento_area").dropdown({
                
                    action:"hide",
                    onChange:function(value,text,$selectedItem) {
                    
                        window.location.href = "index.php?area=" + value;
                    
                    }
                
                });

Ok, it works fine too. The problem is that if the user types “C” and press one of the arrows of the keyboard (down/up) to navigate thgouth the options, as soon as the user presses down key, the event ONCHANGE is fired. This shouldnt happen cause the user still didnt decided what option he wants to choose, he is just using the arrow keys to navigate till the desired option (think about a lazey person or a handcapted).

I think there should be an event that fires only when user selects indeed the option he wants like “onselect”. And I think the behaviour of “onchange” should make it’s name change to “onnavigate”…

Am I doing something wrong and this “onselect” event already exists? In the docs I couldnt find anything about this, only a handful of events.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
batata004commented, Aug 25, 2017

WORKED PERFECTLY!!! I was waiting since February for this solution! This website https://www.deobraemobra.com.br relies heavily in semantic ui and I had to use a terrible hack in the search box at the top! Now I can easily press KEY DOWN in my keyboard to navigate inside the options and the onchange event does not fire.

@Banandrew great help of yours, again you surprised me with good news 😉 This webiste is working perfectly now, I just removed the hack and it was pretty forward to make it work, just added “selectOnKeydown:false” and it worked!

0reactions
awgvcommented, Aug 25, 2017

I’ve just stumbled upon this thread and realized that I mislabeled it—selectOnKeydown property does exactly that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

do not trigger onchange event until focusout? ...
It's fine with the mouse, but when I try to make a selection using my keyboard's arrow keys, the change event fires as...
Read more >
126379 - Select (size=1) onChange not called using down ...
If a mouse/keyboard action > causes the selected item to change, then the onchange event should be fired. It > seems nonsensical to...
Read more >
IE select tag onchange firing causing problems - MSDN
Hi I got the workaround. For keyboard navigation, tab to the element and pressing - 'alt' and 'up' or 'down' arrow opens the...
Read more >
Events: change, input, cut, copy, paste
Let's cover various events that accompany data updates. Event: change. The change event triggers when the element has finished changing.
Read more >
When a Click is Not Just a Click
This is a bit of overlap with keyboard navigation and ... same thing happens where about every key on the keyboard will trigger...
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