Skip to main content

Input Adapters

Hosanna input enters through platform adapters, then flows through InputAdapterManager before focus, pointer, click, drag, or scroll handlers see it.

Simulator, Roku remote, and debugger input normalized into canonical events and routed through focus or design-space geometrySimulator, Roku remote, and debugger input normalized into canonical events and routed through focus or design-space geometry

Roku and Simulator Adapters​

Use ?adapters= selectors in web launch URLs. Runtime logs, debug output, and sourceAdapter metadata use registered adapter names.

Execution environment?adapters= selectorsRegistered adapter namesMain sourceNotes
Browser emulatorroku, keyboard, webkeyboard, debug, mouse, touchrokuRemote, webKeyboardRoku, webKeyboard, webDebug, webMouse, webMouseTouch, touchBrowser keyboard, mouse, pointer, and touch eventsDefault Browser input emulates Roku remote behavior. The keyboard selector registers Roku-style browser keyboard input; webkeyboard registers browser keyboard input. touch converts browser client coordinates to Hosanna design coordinates.
Rokun/arokuRemoteRoku remote key eventsMaps Roku and simulator key names to Hosanna Key values. Long press is generated from held keys.

Canonical Event Shape​

All adapters dispatch one of the shared event types:

Event typeImportant fields
keykey, rawKey, keyState, phase, direction, isKeyPress, isKeyRelease, longPress, sourceAdapter
pointerDown / pointerUpphase, sceneX, sceneY, pointerId, pointerType, sourceAdapter
pointerDragpointer fields plus frameDeltaX, frameDeltaY, totalDeltaX, totalDeltaY, velocityX, velocityY
scrolldeltaX, deltaY, sourceAdapter
clicktargetView, coordinates, and source adapter metadata

Key phases are start, repeat, finish, and cancel. Key states are None, Press, Release, LongPress, LongPressUpdate, and LongPressEnd. A normal key tap often starts with KeyState.None on key down, then emits Press and Release on key up. Long press emits repeat-phase long-press events until release or cancellation.

Touch Coordinates​

Touch adapters normalize host coordinates before shared app code sees them:

  1. A browser touch/pointer event supplies host coordinates.
  2. The simulator bridge converts them into Hosanna scene/design coordinates.
  3. The canonical touch adapter dispatches pointer down, drag, up, cancel, and tap-as-OK events.

App code, CollectionView hit testing, and ScrollView offsets should use Hosanna design points. Do not multiply pointer positions by browser DPI, device pixel ratio, or CSS scale; adapters already account for that.

Touch phases are start, move, end, and cancel at the simulator adapter boundary. Stable pointerId values should be preserved across one pointer gesture.

Remote And Back​

Remote-style adapters normalize arrows to Up, Down, Left, and Right, with matching direction values. Select/OK maps to Ok. Back maps to Back and keeps direction: None.

Develop this behavior in the web simulator and validate its native implementation on Roku.

Remote adapters cancel held-key state on blur, suspend, unmount, and source cleanup. Test Back, release, repeat, and long-press behavior with raw DOM events in previews and with the real remote on hardware.

Adapter Selection​

On web, use ?adapters= selectors to limit active adapters:

http://localhost:5170/?adapters=keyboard,mouse
http://localhost:5170/?adapters=touch
http://localhost:5170/?adapters=webkeyboard

Use the selector names in URLs. Use the registered adapter names when reading runtime/debug output, including sourceAdapter fields.

Develop this behavior in the web simulator and validate its native implementation on Roku.

Talk to us