Ticket #4740 (closed defect: fixed)

Opened 14 months ago

Last modified 5 months ago

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

Reported by: simonjb Owned by: becky
Priority: normal Milestone: 1.2
Component: Accessibility Version: 0.9
Severity: normal Keywords:
Cc:

Description (last modified by becky) (diff)

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

4740.patch (3.9 kB) - added by becky 6 months ago.
update ondijitclick to use onkeypress for enter key in FF

Change History

Changed 14 months ago by becky

  • milestone set to 1.0

Changed 13 months ago by bill

  • milestone changed from 1.0 to 1.1

Changed 11 months ago by bill

  • summary changed from On FF2 and Minefield, pressing enter on a context menu item is passed through to a textarea to On FF2 and FF3, pressing enter on a context menu item is passed through to a textarea

Changed 10 months ago by becky

  • milestone changed from 1.1 to 1.2

Changed 6 months ago by becky

  • 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.

Changed 6 months 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.

Changed 6 months 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)

Changed 6 months 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 6 months ago by becky

update ondijitclick to use onkeypress for enter key in FF

Changed 6 months ago by becky

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

Changed 5 months ago by becky

  • status changed from new to assigned

Changed 5 months ago by becky

  • status changed from assigned to closed
  • resolution set to fixed

(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.