Opened 12 years ago

Closed 12 years ago

#4064 closed defect (fixed)

[patch][ccla] event.js clobbers keyCode in IE

Reported by: haysmark Owned by: sjmiles
Priority: high Milestone: 0.9
Component: Events Version: 0.9
Keywords: 4dijit Cc:
Blocked By: Blocking:

Description

Refer to #4051. That ticket is fixed in Firefox and Safari, but not IE.

Here is the problem code in event.js:

_preventDefault: function(){
	_trySetKeyCode(this, 0);
	this.returnValue = false;
}

Widgets that contain widgets (like InlineEditBox?) need to hear the keyCode of their children (to close the editing dialog on Enter for example). At the same time, the child widgets need to prevent default actions like form submit, button press etc when they run on their own.

event.preventDefault() does just that in Firefox and Safari. The above code breaks this behavior in IE because the keyCode gets set to 0.

Attachments (1)

4064.patch (331 bytes) - added by haysmark 12 years ago.
Proposed fix

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by haysmark

Attachment: 4064.patch added

Proposed fix

comment:1 Changed 12 years ago by haysmark

Keywords: 4dijit added
Summary: event.js clobbers keyCode in IE[patch][ccla] event.js clobbers keyCode in IE

comment:2 Changed 12 years ago by sjmiles

Status: newassigned

Zeroing the keyCode was included to effect prevention in some cases, including CTRL combinations that would otherwise trigger IE menu items.

If we remove that line then we have a trade-off between preventDefault sometimes just not working, and being able to preventDefault while still bubbling.

I don't immediately see a way of solving it without pitfalls.

I suspect that if we have IE clobber keyCode only if CTRL key is down, we can get a solution that works more often than not. There are a couple of workarounds in the corner case (e.g. I will see if I can stuff a copy of the code into a bubbledKeyCode property, just in case).

Caveat: there may be other keys that need this kind of prevention. I didn't identify the actual cases in my keyboard notes (http://turboajax.com/dojo/key_compat.html).

comment:3 Changed 12 years ago by sjmiles

(In [10034]) Less zealousness when clobbering keyCodes in preventDefault for IE, refs #4064.

comment:4 Changed 12 years ago by sjmiles

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.