Closed Bug 751801 Opened 12 years ago Closed 12 years ago

initKeyboardEvent + dispatchEvent doesn't work in Firefox 12

Categories

(Firefox :: Untriaged, defect)

12 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 749185

People

(Reporter: marc.fawzi, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20100101 Firefox/12.0
Build ID: 20120420145725

Steps to reproduce:

var e = document.createEvent("KeyboardEvent");
						
	e.initKeyEvent("keypress", 
					  	false, 
						true, 
						null, 
						false, 
						false,
						false, 
						false, 
						null, 
						val.charCodeAt(0));// char code.
	myTextAreaElement.dispatchEvent(e);

On http://idibidart.com the virtual keyboard worked fine until Firefox 12 came out then it stopped working. I had asked here and someone from Mozilla who was terribly mistaken suggested that it had to do with some security issue. I believed it then because my key events are being sent to a text area on an iframe that's hosted on a different domain... But when I replaced it with a textarea defined in the same window I did not see any difference. The keyboard event dispatching simply broke.

What the heck is going on


Actual results:

see above


Expected results:

the keyboard event should dispatch normally.. CAN SOMEONE SHOW ME A WORKING EXAMPLE OF KEYPRESS EVENT BEING DISPATCHED TO A TEXTAREA IN FIREFOX 12????? That's all I need to fix my app, used by thousands of now unhappy users...

THANKS
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
FOR EXAMPLE THIS WORKS ON CHROME:

var eventObject = document.createEvent('TextEvent');
eventObject.initTextEvent('textInput',
                          true,
                          true,
                          null,
                          textToInsert);

textarea.dispatchEvent(eventObject);

DOM3 Standard. If Firefox removed KeyboardEvent why is it still in MDN documentation (what idiocy is that!) I sure hope the Firefox team has enough brain cells in the collective head to figure out that many applications out there depend on sending text into textareas via simulated keypress or DOM3 TextEvent
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
So this means the idiots at Mozilla have done it again: removed a non-standard feature from Firefox without replacing it with its Standard version (given above, and supported by Webkit among others)
textInput event has been dropped from D3E. And that is really different from key events.

Why don't you modify the value of textarea directly?

# This is really a dup of bug 749185, please don't change the state.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → DUPLICATE
And you should discuss in www-dom for deciding what is the best behavior of editors with untrusted key events. It doesn't make sense to talk only for *a* browser's behavior.
You need to log in before you can comment on or make changes to this bug.