[Keyboard] Have a way to disable / enable soft keyboards

NEW
Unassigned

Status

Firefox OS
Gaia::Keyboard
4 years ago
a year ago

People

(Reporter: janjongboom, Unassigned)

Tracking

(Blocks: 2 bugs)

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Feature request from apc.io at https://github.com/apc-io/apc-firefox-os/issues/8

They would like to have a way to disable the soft keyboard (other than via a pref). I guess the nice way would to add an API to navigator.mozInputMethod.mgmt in Gecko to handle this. Should not be very hard.

:yxl, what do you think?
(Reporter)

Updated

4 years ago
Flags: needinfo?(xyuan)
(Reporter)

Updated

4 years ago
Assignee: nobody → janjongboom
It is reasonable way to add an API for that. But we need Rudy to confirm the requirement before implementation.
Flags: needinfo?(xyuan) → needinfo?(rlu)
Created attachment 815384 [details] [diff] [review]
Gecko part

I think Rudy is traveling from Canada or something. Anyway, I was in a plane for two hours and didn't have anything to do, so here's the gecko part.
Attachment #815384 - Flags: review?(xyuan)
(Reporter)

Updated

4 years ago
Blocks: 925357
Try: https://tbpl.mozilla.org/?tree=Try&rev=5d8d5c8ac0ca
Comment on attachment 815384 [details] [diff] [review]
Gecko part

Review of attachment 815384 [details] [diff] [review]:
-----------------------------------------------------------------

r=me. The code looks good to me.

::: dom/inputmethod/MozKeyboard.js
@@ +243,5 @@
>  
>  MozInputMethodManager.prototype = {
>    _supportsSwitching: false,
>    _window: null,
> +  _softKeyboardEnabled: true,

I prefer to using `false` as default value.

@@ +289,5 @@
> +  },
> +
> +  get softKeyboardEnabled() {
> +    if (!WindowMap.isActive(this._window)) {
> +      return true;

The same. When keyboard is not active, return false.

::: dom/webidl/InputMethod.webidl
@@ +57,5 @@
>    void hide();
> +
> +  // Tell the OS to enable/disable the soft keyboard
> +  // f.e. when a hardware keyboard is attached.
> +  attribute boolean softKeyboardEnabled;

Can we use the name `enabled` without prefix as that of the `hide()` method? Is the prefix `softKeyboard` necessary?
Attachment #815384 - Flags: review?(xyuan) → review+
(In reply to Yuan Xulei [:yxl] from comment #4)
> I prefer to using `false` as default value.
I don't really agree, the default should be that soft keyboard would pop up as it's the desired behavior for 99,999% of all devices running FxOS at the moment.

> Can we use the name `enabled` without prefix as that of the `hide()` method?
> Is the prefix `softKeyboard` necessary?
Could be, but it misses context. `mgmt.enabled = false` would give me the impression that you can disable the `mgmt` module or something. Let me know if you agree/disagree.
Sorry for late reply.
Yes, we need an API to know if there is an hardware keyboard present for the device.

Does the current implementation conform to what Tim proposed in,
https://wiki.mozilla.org/User:Timdream/InputMethod_API_with_hardware_keyboard

If not, can we counter propose there?
Thanks.
Flags: needinfo?(rlu)
I added comments in the API proposal. We're trying to reach the same path as in the proposal, so let's finish that discussion first before continuing here.
Blocks: 929365
(Reporter)

Updated

3 years ago
Assignee: janjongboom → nobody
You need to log in before you can comment on or make changes to this bug.