Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#15130 closed bug (notabug)

Autocomplete: keyboard navigation with source object

Reported by: Rob Garrison 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:

https://cloud.githubusercontent.com/assets/136959/22358314/ad9db854-e403-11e6-8193-e51385a02b5e.gif

Change History (5)

comment:1 Changed 2 years ago by Rob Garrison

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

Last edited 2 years ago by Rob Garrison (previous) (diff)

comment:2 Changed 2 years ago by Scott González

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.

comment:3 in reply to:  2 Changed 2 years ago by Rob Garrison

Ok, thanks for a great library!

comment:4 Changed 2 years ago by Scott González

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.

comment:5 Changed 2 years ago by Scott González

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

Note: See TracTickets for help on using tickets.