Closed Bug 1210739 Opened 9 years ago Closed 9 months ago

Input confusion when Numlock is off

Categories

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

44 Branch
Desktop
Windows
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: mark, Unassigned)

Details

This seems to be a legacy bug.

When entering input in text fields, you can use Alt-numberkeys to enter specific key codes for e.g. accented characters. This works fine when Numlock is on, and as-expected. But when numlock is off, the bahvior is really confused:
* Any Alt+character combination that has a shortcut key activates that shortcut (as expected), like Alt+leftarrow (4) or Alt+Home (7)
* Any Alt+character combination that doesn't have a shortcut key acts as-if Numlock is on. I think this is a bug and causes a lot of confusion.

The resulting effect is extremely inconsistent when Numlock is off:
e.g. Alt+0233 gives an accented character as-if Numlock is on (é)
e.g. Alt+0234 navigates the browser back when "4" is hit, instead of inputting (ê)

We should change the code so Firefox's keyboard handling treats the numpad properly according to its numlock state, instead of this mish-mash. This means when Numlock is off, it should never treat keypresses as number keys (like it does now), but rather their arrow/home/end/ins/del/pgup/pgdn control keys.
Key event handling depends on the platform, so, what are you using?

And could you post STR with specific keyboard layout?
Flags: needinfo?(mark)
Windows 7 x64
en-US keyboard layout
Standard desktop keyboard (logitech), standard windows drivers.

STR:
1. Set numlock off
2. Focus a text input field in the browser
3. Attempt to input an extended character with alt code

if no shortcut is hit, it will accept the input as-if numlock is on (bug)
if a shortcut is hit, the shortcut is executed (correct)
Flags: needinfo?(mark)
> 3. Attempt to input an extended character with alt code

Could you explain the detail of this? I'm not familiar with US keyboard layout's special behavior (like inputting with Alt key).
Flags: needinfo?(mark)
Really? I thought that would be common knowledge.

Press down and hold the Alt key, then input the character code with numbers, then let go of the Alt key. This is the standard way of accessing extended characters that are not part of the actual keyboard's directly-accessible layout.
Flags: needinfo?(mark)
(In reply to Mark Straver from comment #4)
> Really? I thought that would be common knowledge.
> 
> Press down and hold the Alt key, then input the character code with numbers,
> then let go of the Alt key.

Ah, I see what you are talking about. I misunderstood US keyboard layout can input a Unicode character with Alt key + a printable key.
QA Whiteboard: qa-not-actionable

In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.

Severity: major → --

The severity field is not set for this bug.
:dao, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(dao+bmo)

I don't reproduce this bug anymore in Win11. Alt + 0, 2, 3, 3 does nothing input into the search bar when NumLock is off.

Status: UNCONFIRMED → RESOLVED
Closed: 9 months ago
Component: Keyboard Navigation → DOM: UI Events & Focus Handling
Flags: needinfo?(dao+bmo)
Product: Firefox → Core
Resolution: --- → WORKSFORME
OS: Unspecified → Windows
Hardware: Unspecified → Desktop

Is there any indication of a possible version range that this was fixed for the various mozfork codebases that might want to pick up this change?

You need to log in before you can comment on or make changes to this bug.