Key Events give “0” for many X11-defined keys

UNCONFIRMED
Unassigned

Status

()

P3
normal
UNCONFIRMED
2 years ago
2 years ago

People

(Reporter: brpocock, Unassigned)

Tracking

49 Branch
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0
Build ID: 20160919122641

Steps to reproduce:

“Media keys” and other “non-typewriter” keys under Linux are reported by Firefox with no useful ID's

Easily visible by inspecting keyboard events




Actual results:

EG, my “Properties” key yields:

keydown  keyCode=0         which=0         charCode=0        
         shiftKey=false ctrlKey=false altKey=false metaKey=false
         key=Unidentified char=undefined location=0 repeat=false
keypress keyCode=0         which=0         charCode=0        
         shiftKey=false ctrlKey=false altKey=false metaKey=false
         key=Unidentified char=undefined location=0 repeat=false
keyup    keyCode=0         which=0         charCode=0        
         shiftKey=false ctrlKey=false altKey=false metaKey=false
         key=Unidentified char=undefined location=0 repeat=false

xev reports:

KeyPress event, serial 36, synthetic NO, window 0x2600001,
    root 0x10c, subw 0x2600002, time 2215449041, (42,41), root:(1462,326),
    state 0x0, keycode 68 (keysym 0x1005ff70, SunProps), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x2600001,
    root 0x10c, subw 0x2600002, time 2215449234, (42,41), root:(1462,326),
    state 0x0, keycode 68 (keysym 0x1005ff70, SunProps), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

Note that there's a valid KeySym bound there

This wouldn't be a problem if it were just the one key, but since FFox reports many different “media” and “special” keys in this way, it's impossible to map them to JS events.


Expected results:

Ideally, if Firefox cannot map a keysym to one of its internal table of “well-known keys,” return the underlying KeySym from X11, perhaps with it bit-shifted or with some constant added so it cannot conflict with the range established for the “well-known keys.” (The same could probably be said for other environments?)

Updated

2 years ago
Component: Untriaged → Event Handling
OS: Unspecified → Linux
Product: Firefox → Core
Hardware: Unspecified → x86_64
Masayuki, do you have thoughts on what we should do here?
Flags: needinfo?(masayuki)
Priority: -- → P3
First, we won't touch .keyCode anymore except when only Gecko sets different value and the value isn't used by another key.

Next, I think that I mapped almost all of available .key values to keysyms. So, if you know I missed to map some .key values to specific keysyms, please list up them.

Finally, if you can type some keysyms from your keyboard (or other input devices) which cannot be mapped to any .key values, please list up the keysyms with explanation of which keyboard layout has them and what should occur when you press the keys.
Flags: needinfo?(masayuki)
You need to log in before you can comment on or make changes to this bug.