Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9694 closed bug (notabug)

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)

Change History (10)

comment:1 Changed 9 years ago by Scott González

Resolution: notabug
Status: newclosed

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

comment:2 Changed 9 years ago by paftek75

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

comment:3 Changed 9 years ago by Scott González

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

comment:4 Changed 9 years ago by paftek75

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

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

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.

comment:6 Changed 9 years ago by paftek75

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.

comment:7 Changed 9 years ago by Scott González

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

comment:8 Changed 9 years ago by paftek75

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?

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

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

comment:10 Changed 9 years ago by paftek75

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.

Note: See TracTickets for help on using tickets.