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.

Pressing 'enter' key on Select component does not automatically select an item.

See original GitHub issue

While having a Select component and the drop down menu is active, pressing the ‘enter’ key (without selecting an item) causes the drop down menu to close without passing an item to Select’s field.

Expected Behavior

As a user when the drop down list is active and I haven’t chosen an item from the list I expect to press enter and have the first item automatically selected. The existing functionality with arrow keys should continue to work.

Actual Behavior

Pressing enter just closes the active dropdown menu without passing an item.

URL, screen shot, or Codepen exhibiting the issue

https://codepen.io/Segovia/pen/zdBbex?&editors=0010

Steps to Reproduce

  1. Open the drop down menu
  2. Press enter without choosing an item
  3. The active list closes without a selected item.

Your Environment

  • Grommet version: 1.4.1
  • Browser Name and version: 60.0.3112.78 (Official Build) (64-bit)
  • Operating System and version (desktop or mobile): 4.12.3-1-ARCH

There is the onEnter function, that can be found here that handles that specific behavior. I believe that pressing enter should:

  • Select the item that the user selected (with arrow keys).
  • Select the first item on the list/drop down menu if none was selected by the user.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
george-aidonidiscommented, Aug 9, 2017

@dgennetten I am thinking that I did not make a good job on explaining the second bullet. Here is a more detailed explanation:

  • User opens the drop down menu.
  • User types an item in order to filter it from the list. The item comes up first to the list.
  • User presses enter (without selecting it with arrow keys) and the item becomes selected.

This does not happen here (user presses enter and the item on top does not become selected).

peek 2017-08-09 10-40

0reactions
mariosantcommented, Sep 13, 2017

Thank you for your response, @karatechops .

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-select Creatable: override default behavior upon ...
Currently whenever the user types something in and presses Enter key, it gets added as a new option. Is there a way to...
Read more >
Solved: ComboBox automatically select item on key press
Hello, I have a combobox that once you enter the control, sets the .DroppedDown property to True so it will expand the box...
Read more >
Keyboard-navigable JavaScript widgets - Accessibility | MDN
When set to -1 , the element becomes focusable by script, but it does not become part of the keyboard focus order.
Read more >
Select | Quasar Framework
In case you are looking for a dropdown “button” instead of “input” use Button Dropdown instead. QSelect API. QSelect ...
Read more >
Understanding Success Criterion 3.2.2 - W3C
Clicking on links or tabs in a tab control is activating the control, not changing ... H84: Using a button with a select...
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