Closed Bug 287172 Opened 20 years ago Closed 5 years ago

event properties ctrlKey and altKey are false when pressed simultaneously

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

1.0 Branch
x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: michael.virnstein, Unassigned)

References

()

Details

(Keywords: helpwanted)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041217
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041217

When i try to access event.altKey and/or event.ctrlKey they are set to false
when both modifiers are pressed simoultaneously. event.shiftKey always works as
expected.

Script to reproduce:

<html>
<head>
<title>Modifier Test</title>
</head>
<body>
<form>
<input type="text" name="testfield">
<script language="Javascript">
    function testfunc(e) {
        alert(e.shiftKey+' '+e.altKey+' '+e.ctrlKey);
    }
    document.forms[0].testfield.onkeydown = testfunc;
</script>
</form>
</body>
</html>

Reproducible: Always

Steps to Reproduce:
1. cut&paste the script above and save file as html
2. click shift + ctrl + alt in any combinations

Actual Results:  
you'll see, that if alt and ctrl are pressed simultaneously, e.altKey and
e.ctrlKey are both set to false

Expected Results:  
e.altKey and e.ctrlKey should have both been set to true
Status: UNCONFIRMED → NEW
Component: General → Event Handling
Ever confirmed: true
Keywords: helpwanted
Product: Mozilla Application Suite → Core
Version: unspecified → 1.0 Branch
Attached file Original Testcase
Posting original testcase.
Chances are, this is a Windows widget bug, if it was reproduced on Windows...
WFM, SeaMonkey trunk build 2005041106 on WinXP SP2.
Assignee: general → nobody
QA Contact: general → events
shaver can't reproduce this either, using http://xirc.chez.com/onkeydown.html

Someone who _can_ reproduce.... is there something interesting about your system that might cause you to see this when others do not?
Definitely has to do with keyboard layout
Was set to French (Canada) / French (Canada)

Switched to English (US) / English (US)
Alt and Ctrl are correctly detected

Went with French (Canada) / English (US)
Still detected

Back to French (Canada) / French (Canada)
Gone
Interesting...  What are the parts before/after he slash there?
Should be language / layout
http://img696.imageshack.us/img696/5998/keyboardk.png

There are no difference between a layout in different languages
English (US) / French (Canada) has the same problem
Could this be it, http://www.mozilla.org/editor/key-event-spec.html

If an alphanumeric key (a - z or 0-9) is pressed, a charcode value must be returned, even if a modifier bit is set. If the charcode is a resulting character which should be inserted in an editor, all 4 modifier flags should be cleared (0).

But wouldn't it also clear the flags for Shift + 1
- alphanumeric key
- charCode 33 is a printable character "!"
Component: Event Handling → User events and focus handling

Masayuki, do you know whether is this still reproducible?

Flags: needinfo?(masayuki)

Should've been fixed by bug 900750. Currently, if active keyboard layout has AltGr key and it's pressed, Alt and Ctrl keys are set to false as reported. If Alt + Ctrl are pressed for emulating AltGr key, it depends on active keyboard layout and the pressed key introduces a character. If the key combination introduces a character, both altKey and ctrlKey are set to false. However, otherwise, they should be set to true. But be aware, we have bug 1596916 for the latter case. It requires new flag to our internal keyboard event so that I'll take it after next merge. Anyway, the reported issue was fixed at least once. If you need to track the bug, please cc yourself in bug 1596916.

Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(masayuki)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: