Skip to main content

Search and Top Navigation

#9694 closed bug (notabug)

Opened December 06, 2013 03:40PM UTC

Closed December 06, 2013 03:41PM UTC

Last modified December 06, 2013 05:24PM UTC

Prevent focus of disabled item with keyboard navigation

Reported by: paftek75 Owned by:
Priority: minor Milestone: none
Component: ui.menu Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:
Description

Disabled items cannot be focused with the mouse, but it is possible with the keyboard:

http://jqueryui.com/menu/

Thus in the autocomplete widget it is possible to focus a disabled item and then select it:

http://jsbin.com/AyuNiyem/1 (type "a" and use keyboard arrows)

Attachments (0)
Change History (10)

Changed December 06, 2013 03:41PM UTC by scottgonzalez comment:1

resolution: → notabug
status: newclosed

This is intended, so that the items are discoverable by visually impaired users.

Changed December 06, 2013 03:44PM UTC by paftek75 comment:2

OK I understand. But autocomplete should prevent to select the item with the enter key ?

Changed December 06, 2013 03:46PM UTC by scottgonzalez comment:3

I suppose. Why are there disabled items in your autocomplete? I don't think I've ever seen that.

Changed December 06, 2013 04:01PM UTC by paftek75 comment:4

I use it to do a multi selection, (kinda like your example http://jqueryui.com/autocomplete/#multiple), but I disable the items already selected.

Changed December 06, 2013 04:06PM UTC by scottgonzalez comment:5

Seems strange, since the it's not actually providing any value to the user. But feel free to file a new issue for it to get a discussion going.

Changed December 06, 2013 04:33PM UTC by paftek75 comment:6

The value provided is completely subjective and I do not want to discuss that here. In some cases it makes sense for the user to see that his search match something although it is no more selectable.

But you have definitively a bug here. The mouse behaviour is right, the keyboard is not.

Pressing ENTER on a disabled item triggers a "select" event:

http://jsbin.com/AyuNiyem/2/

The select method of the menu widget should do nothing if the active item is disabled. It will solve the bug and the inconsistency problem.

Changed December 06, 2013 04:34PM UTC by scottgonzalez comment:7

This is not a bug in menu. As requested, please file an issue about autocomplete.

Changed December 06, 2013 04:53PM UTC by paftek75 comment:8

In the menu widget all the "this.select()" calls are surrounded by a check to the "ui-state-disabled" class. But this "select" method is exported and anybody can call it to select the active item regardless of its state... Does it sound right to you?

Changed December 06, 2013 04:56PM UTC by scottgonzalez comment:9

Yes, just like you can programmatically select a disabled select option in a native control.

Changed December 06, 2013 05:24PM UTC by paftek75 comment:10

You are right here but disabled items cannot be activated with keyboard on native control. That's why it feels strange to me. http://jsbin.com/AYiyEho/2

Anyway I have filled a new bug. Let's see what happen on the autocomplete side. Thanks.