Opened 12 years ago

Closed 11 years ago

#4740 closed defect (fixed)

On FF2 and FF3, pressing enter on a context menu item is passed through to a textarea

Reported by: simonjb Owned by: Becky Gibson
Priority: high Milestone: 1.2
Component: Accessibility Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Becky Gibson)

To reproduce:

  1. open dijit/tests/test_Menu.html
  2. click in the "hello there!" textarea to give it focus
  3. right click in the "hello there!" textarea to open the context menu
  4. press enter on the first menu item and dismiss the alert when it opens
  5. a newline is added to the textarea

I have observed this behavior in FF 2.0.0.7 and a recent nightly build of Minefield. I do not see the behavior in IE6 or IE7 (they behave as expected.)

Attachments (1)

4740.patch (3.9 KB) - added by Becky Gibson 11 years ago.
update ondijitclick to use onkeypress for enter key in FF

Download all attachments as: .zip

Change History (12)

comment:1 Changed 12 years ago by Becky Gibson

Milestone: 1.0

comment:2 Changed 12 years ago by bill

Milestone: 1.01.1

comment:3 Changed 11 years ago by bill

Summary: On FF2 and Minefield, pressing enter on a context menu item is passed through to a textareaOn FF2 and FF3, pressing enter on a context menu item is passed through to a textarea

comment:4 Changed 11 years ago by Becky Gibson

Milestone: 1.11.2

comment:5 Changed 11 years ago by Becky Gibson

Description: modified (diff)

I am tempted to close this as wontfix because I believe it is a Firefox bug (probably related to https://bugzilla.mozilla.org/show_bug.cgi?id=245571) where you cannot cancel keydown events even when the event object is marked cancelable=true. We use ondijitclick in menuitem to catch the onkeydown of the enter press or the click on the menu item. If I add a specific onkeypress handler for the enter key, the problem does not occur because onkeypress is properly canceled by Firefox.

comment:6 Changed 11 years ago by bill

Hmm, you can close if you want but I think the problem might be more serious than you think. I added this code to the beginning of test_Menu.html:

<form id="myForm" action="" method="">
	<input name="myInput" value="bill was here">
	<button type="submit" name="mySubmit">submit</button>
</form>

(it's just a form, nothing special)... and if you are focused on the button and then open the menu and use ENTER to select a menu option, the form submits.

I'm sure it's due to a firefox bug but OTOH, the whole purpose of ondijitclick is to workaround browser bugs.

comment:7 Changed 11 years ago by liucougar

the same wrong behavior is observed for the refactored editor in FF3 too: load dijit/tests/_editor/test_noiframe.html, select something in the first editor, then use shift-tab to move to the first button and press enter, the selected text is replaced by a new line (enter is received by the editor so it processes it and inserts a new line)

comment:8 Changed 11 years ago by liucougar

one way to fix the editor issue (and probably the original one and the one mentioned by bill) is to use ondijitclick for the outer div in Button.html instead of onclick, and add the following lines to the top of _onButtonClick in Button.js:

//if this is not onclick events, it should be key events, stop it to prevent browser to activate default behavior, because we will call our expected handler later in this function
if(e.type!='click'){
	dojo.stopEvent(e);
}

Changed 11 years ago by Becky Gibson

Attachment: 4740.patch added

update ondijitclick to use onkeypress for enter key in FF

comment:9 Changed 11 years ago by Becky Gibson

(In [14033]) refs #4740 update ondijitclick to use onkeypress for enter key in FF !strict

comment:10 Changed 11 years ago by Becky Gibson

Status: newassigned

comment:11 Changed 11 years ago by Becky Gibson

Resolution: fixed
Status: assignedclosed

(In [14228]) fixes #4740 updated button to use ondijitclick. modified button onclick to stop event when is not a click (and thus a key) - this prevents activation of a button on the editor toolbar via the keyboard from passing through into editor in FF.

Note: See TracTickets for help on using tickets.