Closed Bug 1596916 Opened 6 years ago Closed 5 years ago

AltGr + key which shouldn't cause any character causes inputting character which is inputted without AltGr

Categories

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

70 Branch
Unspecified
Windows
defect

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox-esr68 --- wontfix
firefox74 --- wontfix
firefox75 --- wontfix
firefox76 --- fixed

People

(Reporter: tszynalski, Assigned: masayuki)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

  1. Switch to the UK English or Polish keyboard layout on Windows.
  2. Type AltGr+K anywhere in Firefox (including browser UI).

Actual results:

The letter "k" was typed.

Expected results:

Nothing should happen. AltGr+K are not bound to any characters in the UK or Polish keyboard layouts. Firefox is the only application which ignores AltGr in this way. The same problem of course occurs on any other keyboard layout which has AltGr (most non-US layouts).

I think this might be the result of the recent changes in how JS keyboard events are processed. Per the most recent W3C UI Events draft, if "AltGr+Key" is pressed, KeyboardEvent.altKey or KeyboardEvent.ctrlKey should be false (previously, both were true). Instead, the state of the AltGr modifier must be accessed via KeyboardEvent.getModiferState("AltGraph").
This is why, if you don't make a point of checking .getModifierState(), the event looks exactly as if bare "Key" was pressed. Maybe that's why Firefox sees it that way.

Component: Untriaged → Keyboard Navigation
Component: Keyboard Navigation → Widget: Win32
OS: Unspecified → Windows
Product: Firefox → Core

The priority flag is not set for this bug.
:jimm, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)
Flags: needinfo?(jmathies)
Priority: -- → P3
Component: Widget: Win32 → DOM: UI Events & Focus Handling
Priority: P3 → --

Perhaps duplicate to bug 809410. :masayuki could you please take a look and suggest the priority for this one?

Flags: needinfo?(masayuki)

No, not dup of it. We should fix this, but not urgent.

Flags: needinfo?(masayuki)
Priority: -- → P3
Assignee: nobody → masayuki
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Must be a regression of bug 900750. If so, this could be reproducible on Linux in theory. However, as far as I've tested, keyboard layouts on Linux can type something with every key with AltGraph (Level 3 Shift) modifier.

Keywords: regression
Regressed by: 900750
Summary: "AltGr+Key" on non-US keyboard layouts is detected as "Key" [Windows] → AltGr + key which shouldn't cause any character causes inputting character which is inputted without AltGr

On Windows, AltGr modifier state is represented with activating both
Alt and Ctrl modifiers. I.e., when AltGr is pressed, any shortcut
keys whose modifier require Control and/or Alt because NativeKey
needs to consume both flags and set modifier state to only AltGraph.

That means that we don't need to dispatch eKeyPress event when AltGr key
is pressed and the key does not produce a character since we've stopped
dispatching non-printable keypress events on web content.

See the automated test changes for the detail in chrome script handling for
its detail.

No longer blocks: 308565
See Also: → 308565
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/f34710995934 Make `NativeKey` stop dispatching `eKeyPress` event when the key does not produce a character with `AltGr` key r=m_kato,smaug
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: