Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#11765 closed defect (wontfix)

ComboBox: Dojo 1.5 change for ENTER key

Reported by: Glenn Williams Owned by:
Priority: high Milestone: tbd
Component: Dijit - Form Version: 1.5
Keywords: combobox enter key Cc:
Blocked By: Blocking:

Description

Dojo 1.3: Open a combobox and highlight the first item programmatically. Hit the enter key and the highlighted item is selected.

Dojo 1.5: This no longer works. The enter key closes the list without selecting the item.

Is this a bug? Or a feature of the new release?

Change History (7)

comment:1 Changed 9 years ago by bill

It sounds like neither, but I don't know how you are "programatically highlighting the first item"... using the arrow keys to arrow down to a certain item and then pressing the enter key still selects the item, right? If so, probably you are depending on some internal method that has changed behavior?

comment:2 Changed 9 years ago by bill

Component: GeneralDijit
Owner: anonymous deleted
Summary: Dojo 1.5 change for ENTER key and ComboboxComboBox: Dojo 1.5 change for ENTER key

comment:3 in reply to:  1 Changed 9 years ago by Glenn Williams

Replying to bill:

It sounds like neither, but I don't know how you are "programatically highlighting the first item"... using the arrow keys to arrow down to a certain item and then pressing the enter key still selects the item, right? If so, probably you are depending on some internal method that has changed behavior?

We are using the following method which wraps the combobox menu method:

_highlightFirstOption: function( e ) {

glw Highlight the first option in the menu this._popupWidget.highlightFirstOption();

},

Arrow down actually selects the item, you can hit ESC or ENTER it doesn't matter at that point because the item is selected by the arrow down key. This is how it works in the Dojo unit test (http://archive.dojotoolkit.org/nightly/checkout/dijit/tests/form/_autoComplete.html?testWidget=dijit.form.ComboBox)

I agree with you that "some internal method that has changed behavior", I have to explain to a user community why its changed. The current 1.5 release seems to remove all functionality from the ENTER key. As far as I can tell it has no role in the 1.5 release.

I'm not sure this worked before but highlighting an option with the mouse (open selection, drag mouse across options) and pressing ENTER does not select the option. I can't find an actual scenario that the ENTER key plays a role in.

This is a bit buggy because a user using the keyboard has to down arrow to select a value, not overly intuitive especially for a list that is open and has an item highlighted (we are using dynamic loading for the options, they contain no values until the user interacts with the widget, we highlight the first option because its the best possible choice for the user). The feature currently in Dojo for selecting the first item in the list described above makes this worse because the first item is highlighted(but not selected) and the down arrow moves and selects the second item. There is not way to select the originally highlighted item from the keyboard other then down arrow (moves to second item) and then up arrow.

comment:4 Changed 9 years ago by bill

I wouldn't say that the ENTER key has no purpose: it does close the drop down.

As you said, using the arrow keys does "select a value" from the drop down, or more technically speaking, it fills the <input> with that value. IIRC that was a compromise we had to make to get the screen reader to work, or to handle things correctly when the user arrows down and then starts typing... I forget exactly.

I see what you are saying about how you automatically highlight the first item in the drop down. Could you also copy that items value into the <input> box, basically automatically doing whatever happens when the user presses the down arrow key for the first time?

Also, in the latest trunk code the ENTER key submit thes form, assuming that the drop down is open.

comment:5 in reply to:  4 Changed 9 years ago by Glenn Williams

Replying to bill:

I wouldn't say that the ENTER key has no purpose: it does close the drop down.

As you said, using the arrow keys does "select a value" from the drop down, or more technically speaking, it fills the <input> with that value. IIRC that was a compromise we had to make to get the screen reader to work, or to handle things correctly when the user arrows down and then starts typing... I forget exactly.

I see what you are saying about how you automatically highlight the first item in the drop down. Could you also copy that items value into the <input> box, basically automatically doing whatever happens when the user presses the down arrow key for the first time?

Also, in the latest trunk code the ENTER key submit thes form, assuming that the drop down is open.

First, thanks for the quick response. I really appreciate it.

You found my ENTER scenario.

The nice thing about highlighting the first option but not setting the value is specific to our business, although I imagine others may have simular issues. In my case I'm using the combo to return locations for an airport, car, or hotel lookup. So a user types in DEN and gets back the city of denver, the airport in denver, as well as every location on the planet that starts with DEN. An expert user will continue on with DEN (ESC or ENTER if its the first highlighted item) because its the city or airport code they are looking for. The first option in the list is determined by context, and sometimes the first item is the item the user is after, and its not the city or airport code. If I highlight and set the value the expert user loses out on using their typed value.

To get to the bottom line here: a change was made to accommodate some other issue like accessibility (which is very important to us), and the behavior we used in 1.3 is no longer available to us. Does that seem correct?

I can make this work by messing with the keypress function, and that would work for our lookup widget (its custom and inherits from combobox) but we use the Dojo standar combo in other places and that would require modifing (or creating a custom widget) the Dojo standard behavior which I'm not inclined to do. We have a strict policy not to modify third party libraries (extending is cool, which is why Dojo is so very nice).

Thanks for you kind attention.

comment:6 Changed 9 years ago by bill

Resolution: wontfix
Status: newclosed

To get to the bottom line here: a change was made to accommodate some other issue like accessibility (which is very important to us), and the behavior we used in 1.3 is no longer available to us. Does that seem correct?

That sounds right, although I (or you) would need to figure out the exact revision where the behavior changed to really see the reason.

The behavior you describe, where the first option in the drop down list is automatically highlighted, but not copied to the <input>, would be nice to implement in the ComboBox itself if it wasn't for the a11y problem that a blind user doesn't know what that selection is. (The only way to work around that would be to actually focus the drop down list, instead of the <input>, but that's a big change with some drawbacks.)

So I guess we should close this ticket, it sounds like your workaround is the best solution.

comment:7 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.