Skip to main content

Search and Top Navigation

#15130 closed bug (notabug)

Opened January 27, 2017 02:13AM UTC

Closed February 22, 2017 04:24PM UTC

Last modified February 22, 2017 04:33PM UTC

Autocomplete: keyboard navigation with source object

Reported by: Mottie Owned by:
Priority: minor Milestone: none
Component: ui.autocomplete Version: 1.12.1
Keywords: Cc:
Blocked by: Blocking:
Description

Set up autocomplete with a source object. When using a mouse, the input value is updated with highlighted menu item. But when using keyboard navigation (up, down, pageUp, pageDown) to focus on an item, the source value instead of the source label is added to the input.

See the issue in this demo: http://jsbin.com/koregobilu/edit?html,output

Versions of jQuery tested that demonstrate this same problem:

  • 1.12.1
  • 1.11.4
  • 1.10.4
  • 1.9.2

Tested in the latest versions of Chrome & Firefox on a Windows 10 64-bit system.

Screenshot:

[[Image(https://cloud.githubusercontent.com/assets/136959/22358314/ad9db854-e403-11e6-8193-e51385a02b5e.gif)]]

Attachments (0)
Change History (5)

Changed January 27, 2017 04:17AM UTC by Mottie comment:1

_comment0: I also failed to mention that pressing <kbd>Enter</kbd> would add the source value instead of the source label to the input. I have submitted a PR: https://github.com/jquery/jquery-ui/pull/17921485490678152786

I also failed to mention that pressing Enter would add the source value instead of the source label to the input. I have submitted a PR: https://github.com/jquery/jquery-ui/pull/1792

Changed January 27, 2017 08:53AM UTC by scottgonzalez comment:2

The value is supposed to be inserted into the text field. The documentation even says so. The bug is that the label gets inserted with hover, not that the value gets inserted with keyboard navigation.

Changed January 27, 2017 03:08PM UTC by Mottie comment:3

Ok, thanks for a great library!

Changed February 22, 2017 04:24PM UTC by scottgonzalez comment:4

resolution: → notabug
status: newclosed

This is actually not a bug. You're setting the value explicitly in the focus event. The widget is always setting the correct value on its own, which only happens during keyboard navigation.

Changed February 22, 2017 04:33PM UTC by scottgonzalez comment:5

This is probably the behavior you were trying to create: http://jsbin.com/pugidaleza/1/edit?html,output