Version: Smart Feature Phone 3.0

Emulated Cursor

KaiOS supports emulating a cursor in app, which user can control with d-pad. There are two types of settings to invoke emulated cursor in app.

1. Emulated Cursor Handled by System

To enable emulated cursor in app, set cursor to true in manifest.webmanifest file b2g_features item:

{
  "cursor": true
}

App with this setting will have the feature of emulated cursor just as browser tab does. For example, cursor is automatically turned off when focusing on input field, and is turned on after leaving input field.

Note: This type of cursor usage is strongly recommended. For PWA app, KaiOS has enabled emulated cursor as default to provide better user experience, it can be disabled if the app has its own solution (keypad interaction). For package app, it can be enabled if the app needs.

2. Emulated Cursor Handled by App

Note: This type of cursor usage by design lets app have FULL CONTROL of emulated cursor, which means that system will NOT turn on or off cursor for app. That is, app has full responsibilities of when to show and when to hide the cursor. Furthermore, some key events are treated differently when cursor is on, please find more details in the followings:

  1. Turning on cursor will prevent default and stop propagation on key events of Enter, Up, Right, Down, Left.
  2. Turning on cursor will NOT prevent default or stop propagation on key event of RSK, in addition, it will trigger contextmenu event on key event of RSK.
  3. When focus is on an input element (IME is active), app should remember to turn cursor off by itself.
  4. Other than the case of focusing on input elements, there might be other cases that apps need to control.

Emulated cursor handled by system makes the emulated cursor exist in the app all the time like browser tab. If app needs to control cursor on their own, another api virtualcursor is supported.

To get permissions, app must be at least a signed app. Set virtualcursor in manifest.webmanifest file b2g_features item:

{
  "permissions": {
    "virtualcursor": {}
  }
}

To turn on cursor:

navigator.b2g.virtualCursor.enable()

To turn off cursor:

navigator.b2g.virtualCursor.disable()