WebAPI/InputMethod API with hardware keyboard: Difference between revisions
< WebAPI
Jump to navigation
Jump to search
Luke-chang (talk | contribs) (Created page with "Meta bug: [https://bugzilla.mozilla.org/show_bug.cgi?id=929365 bug 929365]. == Idea == The previous iteration of InputMethod API (See WebAPI/KeboardIME) enables the keyb...") |
Luke-chang (talk | contribs) (Routing hardware key events to keyboard app) |
||
Line 6: | Line 6: | ||
== Proposal == | == Proposal == | ||
[[File:InputMethod API with hardware keyboard Concept.jpg]] | |||
This proposal is based on [[WebAPI/BrowserAPI/KeyboardEvent]]. | |||
# The blue lines are the current behavior. [line (1)] | |||
# This proposal is about adding keyboard app into the chain right before the event target (the active app). | |||
# In mozbrowser'''*before*'''keyXXX phase, Gecko dispatches the key events to keyboard app prior to deliver it to the event target if and only if keyboard app is active. [line (2)] | |||
# If keyboard app wants to handle certain keys, it should cancel the events by calling "preventDefault" (or something else, we'll talk about it later). | |||
# If keyboard app doesn't cancel the events, Gecko will then dispatch it to the event target as usual. [line (3)] | |||
# If keyboard app cancels the events, it should be regarded the same as cancelled by the event target and follow the same rules defined in [[WebAPI/BrowserAPI/KeyboardEvent]]. | |||
== Questions == |
Revision as of 06:46, 24 December 2014
Meta bug: bug 929365.
Idea
The previous iteration of InputMethod API (See WebAPI/KeboardIME) enables the keyboard apps to interact with the targeted input field. We would like it to handle the connected hardware keyboard as well.
Proposal
This proposal is based on WebAPI/BrowserAPI/KeyboardEvent.
- The blue lines are the current behavior. [line (1)]
- This proposal is about adding keyboard app into the chain right before the event target (the active app).
- In mozbrowser*before*keyXXX phase, Gecko dispatches the key events to keyboard app prior to deliver it to the event target if and only if keyboard app is active. [line (2)]
- If keyboard app wants to handle certain keys, it should cancel the events by calling "preventDefault" (or something else, we'll talk about it later).
- If keyboard app doesn't cancel the events, Gecko will then dispatch it to the event target as usual. [line (3)]
- If keyboard app cancels the events, it should be regarded the same as cancelled by the event target and follow the same rules defined in WebAPI/BrowserAPI/KeyboardEvent.