Bug 18693 - Cmd-B and Cmd-I events cannot be overriden by JavaScript in editor mode.
Summary: Cmd-B and Cmd-I events cannot be overriden by JavaScript in editor mode.
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 25604 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-23 00:17 PDT by Martin Kou
Modified: 2011-09-07 13:21 PDT (History)
6 users (show)

See Also:


Attachments
Test case (1.49 KB, text/html)
2008-04-23 00:18 PDT, Martin Kou
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.