Bug 18693

Summary: Cmd-B and Cmd-I events cannot be overriden by JavaScript in editor mode.
Product: WebKit Reporter: Martin Kou <martin>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, ayg, davidr, dpopa, eric, mitz
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Macintosh   
OS: OS X 10.5   
Description Flags
Test case none

Description Martin Kou 2008-04-23 00:17:38 PDT
When editor mode is enabled, it is impossible to receive the keydown events of Meta-B and Meta-I in JavaScript. This is a serious problem for implementing web based editors because it is often desirable to implement custom logic for the hotkeys instead of always following the browser's default.

To reproduce the issue:
1. Open the attached HTML test case.
2. Click in the iframe area, a caret should appear indicating the area is editable.
3. Press any Meta combination that's not Meta-I or Meta-B, the correct keycode should be printed out in the editing area.
4. Press Meta-I or Meta-B, the keycode is not printed out indicating the JavaScript logic failed to receive the events.
Comment 1 Martin Kou 2008-04-23 00:18:19 PDT
Created attachment 20765 [details]
Test case
Comment 2 Martin Kou 2008-04-23 00:18:56 PDT
This issue is causing the bug https://dev.fckeditor.net/ticket/1701 in FCKeditor.
Comment 3 Alexey Proskuryakov 2008-04-28 10:53:16 PDT
Confirmed with r32635. IE allows JavaScript to cancel default processing for these events.
Comment 4 mitz 2008-04-28 11:25:45 PDT
Similarly perhaps, Command-I cannot be used in Safari to invoke the Mail Contents of This Page command when in editable text (<rdar://problem/5845299>).
Comment 5 Alexey Proskuryakov 2009-05-08 08:50:43 PDT
*** Bug 25604 has been marked as a duplicate of this bug. ***
Comment 6 Eric Seidel (no email) 2009-05-08 15:41:28 PDT
I looked into this a little yesterday.  We're short-circuiting handling of these events.  I didn't quite know how to hook into the NSResponder/NSTextField model in order to process the key events at the right time however.  It seems we might have to implement our own processKeyEvents: which is called from the EditorClient handleKeyEvent callback.  I should post actual stack traces in the bug for more intelligent discussion.