Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#4772 closed defect (fixed)

DropDownButton focus interaction problem with enter key and popup

Reported by: davidb Owned by: simonjb
Priority: high Milestone: 1.0
Component: Accessibility Version: 0.9
Keywords: Cc: simonjb, alex
Blocked By: Blocking:

Description (last modified by bill)

On Mac OS X, using FF2 open the button dijit test page.

  1. Tab to a DropDownButton
  2. Invoke the drop down menu (enter or space)
  3. On an menu item, press enter

Result: the menu is present.
Expected result: the menu should disappear.

(Thanks for catching this slightlyoff)

Attachments (1)

4772_only_if_seen_keydown.diff (1.9 KB) - added by simonjb 12 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 Changed 12 years ago by davidb

Note the template for this widget has a real html button. I suspect that the menu is closing on enter down, focus is going to the button, and then the enter up cause the button to re-popup the menu.

comment:2 Changed 12 years ago by simonjb

I cannot reproduce exactly the same behaviour on Windows but I am seeing a related issue on FF and IE on Windows. If I press Enter on a menu item and release it quickly the menu disappears and focus goes to the button. However, if I pause for just the right amount of time and then release I see the reported behaviour. Also, if I press Enter and keep it pressed, the key repeat causes the menu to open and close, open and close, repeatedly.

comment:3 Changed 12 years ago by simonjb

Investigated a little more. On Windows it is the key repeat that is causing the trouble. If I disable key repeating I cannot get the menu to reopen when pressing Enter on a menu item.

It looks like maybe on FF2 on Mac the DropDownButton is getting the Enter down?

comment:4 Changed 12 years ago by davidb

Update: it is not the enter up that is re-popping the menu as I had suspected. The menu is actually re-popped up before the enter key is released (observed via debugging). It is as if the enter down event doesn't get swallowed properly when the menu is disposed, and only on the FF2+OSX configuration.

comment:5 Changed 12 years ago by davidb

Before I move on to other bugs, just wanted to mention that combo button seems immune to this bug. This might help with further investigation.

comment:6 Changed 12 years ago by simonjb

Owner: changed from Becky Gibson to simonjb

comment:7 Changed 12 years ago by simonjb

Status: newassigned

comment:8 Changed 12 years ago by simonjb

I had a look at the ComboButton template and I believe that the reason that we are not seeing the same behavior there is because it is using a <div> with ondijitclick whereas the DropDownButton is using a real <button> with onclick.

comment:9 Changed 12 years ago by simonjb

Issue does not happen on latest Minefield nightly on OS X. Only FF2 on OS X.

comment:10 Changed 12 years ago by bill

Priority: normalhigh

comment:11 Changed 12 years ago by simonjb

Added an attachment (4772_only_if_seen_keydown.diff) with a possible work-around. It records when a keydown has been seen on the DropDownButton and only opens the menu when it has seen one (when fired by keyboard.)

The solution is not perfect: I could not find a reliable way to determine if the event had been fired by keyboard (or which key was pressed, space or enter). The nearest I could find was event.detail which is 0 when not fired by mouse. Not mouse does not necessarily mean keyboard though.

The next approach I thought of is to not use onclick for DropDownButton but instead do it by hand: mousedown, keydown, keyup.

I'm thinking that probably for 1.0 we should fix this issue directly in DropDownButton but post-1.0 we could look at generalising across dijit.

comment:12 Changed 12 years ago by simonjb

Talked with Bill on irc, he prefers the 4772_only_if_seen_keydown.diff solution to using mousedown, keydown, and keyup.

Changed 12 years ago by simonjb

comment:13 Changed 12 years ago by simonjb

Resolution: fixed
Status: assignedclosed

(In [11182]) Implemented a work-around for onclick firing on Mac FF2. Fixes #4772: DropDownButton? focus interaction problem with enter key and popup.

comment:14 Changed 10 years ago by bill

Description: modified (diff)

I'm testing this to see if the above change is still necessary.

I can reproduce the problem on 0.9's test_Button.html on FF2/mac (although it works on FF3/mac).

However, I can't reproduce it on FF2/mac or FF3/mac on either trunk or dojo 1.3, even after removing the code in [11182].

comment:15 Changed 10 years ago by bill

(In [17958]) The changes to fix #4772 (DropDownButton? focus interaction problem with enter key and popup) are no longer necessary in trunk, or even in 1.3. Removing from trunk. Refs #4772 !strict.

comment:16 Changed 10 years ago by bill

(In [17959]) Automated test for #4772, refs #4772 !strict.

Note: See TracTickets for help on using tickets.