Closed Bug 1142893 Opened 9 years ago Closed 9 years ago

keyCode incorrect when using latin IME

Categories

(Firefox OS Graveyard :: Gaia::Keyboard, defect)

defect
Not set
normal

Tracking

(feature-b2g:3.0?, tracking-b2g:+, b2g-v2.0 affected, b2g-v2.1 affected, b2g-v2.1S affected, b2g-v2.2 affected, b2g-master affected)

RESOLVED FIXED
feature-b2g 3.0?
tracking-b2g +
Tracking Status
b2g-v2.0 --- affected
b2g-v2.1 --- affected
b2g-v2.1S --- affected
b2g-v2.2 --- affected
b2g-master --- affected

People

(Reporter: yifan, Unassigned)

References

Details

Found inconsistent InputMethodGlue.prototype.sendKey argument in apps/keyboard/js/keyboard/input_method_manager.js at line 192.

The keyboard app uses sendkey(0, keycode, 0) by default. 

It seems it doesn't comply to https://dxr.mozilla.org/mozilla-central/source/dom/webidl/InputMethod.webidl#205 Promise<boolean> sendKey(long keyCode, long charCode, long modifiers, optional boolean repeat);

Using keycode test pages also reflects that the keycode input result in Firefox OS is different from the result in desktop Firefox. 

Test page:
http://www.asquare.net/javascript/tests/KeyCode.html

The proper fix is to make sure parameters of InputMethodGlue#sendKey is in agreement with MozInputContext#sendKey.
blocking-b2g: --- → backlog
feature-b2g: --- → 3.0?
tracking-b2g: --- → +
blocking-b2g: backlog → ---
FYI "What should the keyCode be for key events generated by virtual keyboards?" on dev-webapi.

(In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) from comment #1)
> FYI: Useful testsuite:
> https://dvcs.w3.org/hg/d4e/raw-file/tip/key-event-test.html

Thanks! I will try to see if we have bandwidth to work on this bug.
We would need bug 1137557 to allow Keyboard app take more control over the properties of the KeyboardEvent to dispatch.
Depends on: 1137557
I am declaring this bug as fixed by bug 1137557, at least for A-Za-z0-9 part. The keyCode of other keys are not trusted and the content should never listen for them. To find out the real hardware key, the content should check |evt.code|, which the Gaia Keyboard does not emit currently (since we are not emulating a hardware keyboard).
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
(In reply to Tim Guan-tin Chien [:timdream] (OOO Nov 16-26; please needinfo) from comment #6)
> I am declaring this bug as fixed by bug 1137557, at least for A-Za-z0-9
> part. 

Important detail missing: bug 1137557 turned out allowed IM API to fill in the keyCode for these keys, so Gaia Keyboard app does not need to supply it anyway (and, if it do, it will be ignored).
You need to log in before you can comment on or make changes to this bug.