Closed Bug 418334 Opened 16 years ago Closed 16 years ago

Meta hotkeys cannot be intercepted on Firefox Mac in an editable area

Categories

(Core :: DOM: Editor, defect, P2)

x86
macOS
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: m.kou, Assigned: jaas)

References

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9b3) Gecko/2008020511 Firefox/3.0b3
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9b3) Gecko/2008020511 Firefox/3.0b3

The ability to intercept hotkeys in JavaScript is important for web based editors since they need to keep track of the changes that the user have made. On Firefox Mac, all meta hotkeys cannot be intercepted by JavaScript with key events. This is really bad for web based editors since people would be able to change the document with hotkeys (e.g. Meta-X, Meta-V, Meta-Z, etc.) without the editor knowing about it. Also, it makes it impossible for a web based editor to implement its own undo/redo system to work with Firefox Mac.

Reproducible: Always

Steps to Reproduce:
1. Make an HTML that intercepts keydown events with document.addEventListener('keydown', ...);
2. Make the HTML document editable with document.designMode = 'on';
3. Open the editable HTML in Firefox for Mac.
4. Try to press some Meta key combos in the editable document - they can never be properly intercepted by the keydown event handler.
Actual Results:  
Meta key events cannot be intercepted by JavaScript in Firefox for Mac.

Expected Results:  
Meta combo key events should be detectable in JavaScript just like Ctrl combo key events in Firefox for Windows.
Attached file Test case for the bug.
Regression from the patch for bug 376077?  (That patch was landed on
2008-01-28, just before beta3 came out.)
I've added a second test file which demonstrates some more problems with Meta key handling on the Mac. Launch it and follow these steps. (Note! Need to do these carefully -- behavior is sensitive here.)

1. Select some text in the editable top pane.
2. Press down CMD key
3. Press down C key
4. Release C key
5. Release CMD key

In FF 3 beta 3, this produces two events (show in the logging pane at the bottom):
- key down on the meta key
- key up on the meta key

In FF 2, this produces three events:
- key down on the meta key
- key up on the C key
- key up on the meta key

On Windows (using CTRL instead of meta), this produces five events: key up AND key down events on both the CTRL and C, as well as a key press event.

It would be very nice to get all the key down and key up events on the Mac. However, at a minimum it would be good to at least get the key-up event that FF 2 used to produce. (My software has a critical dependency here!)
We need to fix this for final - Josh can you take..
Assignee: nobody → joshmoz
Flags: blocking1.9+
Priority: -- → P2
This bug (or a very similar one) also prevents the Flash player on the Mac from responding to CMD-A, CMD-X, CMD-C and CMD-V keys in text areas.  You can reproduce this with the text area of any Flash app -- here's a handy one:

http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleExplorer.html

To reproduce problem:
- in the left pane tree control, navigate to Form Elements/Text Area
- click in the "SANDBOX" text area to set focus
- try using CMD-A, CMD-X, CMD-C, CMD-V keys.  These do nothing in Firefox 3 beta 4; they work correctly in Firefox 2.
This is a consequence of bug 382138, which we ultimately decided not to fix for Gecko 1.9. Please see the discussion in that bug. We might want to dupe this bug against that bug.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Josh - what's the solution for flash then?
Same deal. We need to fix bug 382138 and then it will work. We decided not to fix that bug because of risk at this stage of the release. I don't want to re-hash the discussion on bug 382138 too much, but I actually did start working on this a while back and I have part of the patch so I've seen this stuff work with it.
Depends on: 398514
Fixed in Gecko 1.9 by the final patch for bug 398514.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Note that this bug exists in Firefox 2 for Mac OS X.
I'm very glad this was fixed now -- thanks!

Although Firefox 2 did have some problems in this area, it didn't have exactly this bug.  See my comment #3 above for a comparision of FF 2 and FF 3 beta on Max OS X.

Also, see my comment #5 for another example of key handling in Flash that worked in FF2 but not in FF3 beta 3.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: