Open Bug 1017383 Opened 10 years ago Updated 2 years ago

Guess KeyboardEvent.code value from virtual keycode when scancode is 0 (e.g., inputting from VKB)

Categories

(Core :: DOM: Events, defect)

All
Android
defect

Tracking

()

People

(Reporter: masayuki, Unassigned)

References

Details

Attachments

(1 file)

When scancode is 0, we should guess KeyboardEvent.code values from virtual keycode as far as possible. This is necessary to support VKB input. Key events from VKB may not have proper scancode value. But we need to emulate it.
https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#code-virtual-keyboards
Attached patch PatchSplinter Review
This patch adds a mapping table from virtual keycode of Android to .code value.

This patch does NOT map any printable keys in standard position because the mapping depends on selected keyboard layout. Therefore, I think that it's impossible to emulate printable key' code value with a lot of keyboard layouts.
# Android doesn't have an API to compute scancode from virtual keycode like Windows.

FYI: The spec is here:
https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#code-virtual-keyboards

I'll ask this printable key issue to WG tomorrow if we have much time. Otherwise, I'll file a spec bug for it.

Anyway, at least for now, emulating non-printable key's code values is important because it makes I fix bug 936313 easier.
Attachment #8433400 - Flags: review?(bugs)
Need to wait for some resolution for the printable keys, since it would be odd to
support only non-printables, IMO.
Btw, could you add the spec bug url here, if there is such.
Comment on attachment 8433400 [details] [diff] [review]
Patch

Clearing the review request until we have some resolution to the spec bug.

Currently the spec says "code holds a string that identifies the physical key being pressed." so that at least should be changed somehow. There isn't 
anything physical in case of a vkb.
Attachment #8433400 - Flags: review?(bugs)
Sorry.

Garykac said that nobody should "guess" .code value. He will update the document. Let's wait the new explanation for confirming his exact intention.

Resetting assignee which I don't work on in this several months.

Assignee: masayuki → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: