Invalid altKey attribute of the keydown event when typing a character with AltGr

RESOLVED WORKSFORME

Status

()

Core
Widget: Win32
RESOLVED WORKSFORME
a year ago
a year ago

People

(Reporter: Tomasz P. Szynalski, Unassigned)

Tracking

({regression})

48 Branch
x86_64
Windows 7
regression
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

a year ago
1. Go to http://unixpapa.com/js/testkey.html
2. Enable "modifiers".
3. Switch to a keyboard layout that uses key combinations with AltGr, e.g. Polish Programmers, US International, German etc.
4. Type AltGr+E (or another bound AltGr combo).
5. Notice that, for the keydown event for the E keystroke, the altKey and ctrlKey attributes are both false.

If you type an AltGr combo that's not used in the current layout, the altKey and ctrlKey attributes are both set to true, as they should be. (ctrlKey should be true because on Windows, AltGr is implemented as RAlt+LControl).

This is a new bug that breaks sites that use keyboard shortcuts with the Alt modifier key.
Confirmed the issue on Windows 7 32bit, Polish Programmers keyboard layout.

here's regression range:
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=dd12327c3e0c9f21326236ab8843f6f934579490&tochange=6ef9818a44c721778263259641de8259f443d765

looks like it's from bug 1154183.


Then, it's fixed in the following range:

https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=fc4a79cf9ac9681bfbeafb60f0056153b780e99e&tochange=3ba5426a03b495b6417fffb872d42874edb80855

maybe from bug 1293505?.


Tomasz, can you check if it's also fixed on nightly for you?
Blocks: 1154183
Status: UNCONFIRMED → NEW
QA Whiteboard: [bugday-20160905]
Component: Untriaged → Widget: Win32
Ever confirmed: true
Flags: needinfo?(tszynalski)
Keywords: regression
Product: Firefox → Core
See Also: → bug 1293505
Um, this should be a long standing bug.

TextEditor (nsPlaintextEditor) doesn't handle keypress events whose Ctrl or Alt state is true as text input.  Therefore, we used to remove Alt/Ctrl key state in widget when the key press causes some text input.
https://dxr.mozilla.org/mozilla-central/rev/dbe4b47941c7b3d6298a0ead5e40dd828096c808/widget/windows/KeyboardLayout.cpp#567,582,589-590

Instead, WidgetKeyboardEvent should have a flag indicating if it's a printable event.

On the other hand, web pages can retrieve if "AltGraph" is active with KeyboardEvent.getModifierState().
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState

Although, the hack was applied only for keypress but applied for keydown too after bug 1154183?
(Reporter)

Comment 3

a year ago
@arai
Yep, it is fixed in the current Nightly. Thank you for looking into it.
Flags: needinfo?(tszynalski)
per last comment
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.