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.webapp file:

{
  "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.

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 spatialnavigation-app-manage is supported.

To get permissions, app must be at least a privileged app. Set spatialnavigation-app-manage in manifest.webapp file:

{
  "type": "privileged", // or "certified"
  "permissions": {
    "spatialnavigation-app-manage": {}
  }
}

To turn on cursor:

navigator.spatialNavigationEnabled = true;

To turn off cursor:

navigator.spatialNavigationEnabled = false;