Skip to content
Ooidget

Ooidget Component Format 0.1Editor's Draft

Input, focus and accessibility

Hit-testing

To find the instance under a point, a runtime walks the instance tree from the root: an instance is hit if the point is inside its box and it is shown; among its children, the last in drawing order that is hit wins; if none is, the instance itself is the target. Layers are not hit-tested; regions are.

Regions

A widget’s regions names parts of it: each member is a box [x, y, w, h] or a frame. The first region in member order that contains the pointer is ui.region. A layer with region names its own box too.

Input model

Devices produce the abstract events of Behaviours. A runtime MUST map its platform’s input as follows, and MUST document any other mapping it makes:

Device inputEvents
Mouse, pen, trackpad press and movepress, drag, release, click, dblclick; ui.hover while over
Mouse wheel, trackpad scrollwheel, one notch per 120 units of WheelEvent.deltaY in DOM_DELTA_PIXEL
Touchas a pointer, without hover; long press: context
Rotary (Digital Crown, rotating bezel, encoder)rotate, to the focused instance
Spatial (hand ray, gaze and pinch)as a pointer on the panel’s plane; pointerType: "spatial"
Keyboardkey to the focused instance; Enter and Space on a focusable instance without a key handler: click

On touch devices, the hit area of a focusable or clickable instance SHOULD be at least 44 × 44 design units, extended symmetrically around its box where the layout leaves room.

Focus

An instance with focusable: true takes keyboard and rotary focus. Tab and Shift+Tab move focus through focusable instances in tree order. A press on a focusable instance focuses it.

A widget embedded among a host’s own controls takes part in the host’s focus order. When Tab moves past its last focusable instance, or Shift+Tab before its first, focus leaves the widget: the runtime clears its focus and reports this to the host, which focuses its next control. Focus entering the widget lands on its first focusable instance, or its last when it comes back with Shift+Tab.

Accessibility

Every instance with a role is exposed to the platform’s accessibility interface with that WAI-ARIA role [WAI-ARIA-1.2], its label as accessible name, and, for range roles (slider, spinbutton, progressbar, meter, scrollbar), the view’s value, min and max as its value. Two-state roles (switch, checkbox, radio, menuitemcheckbox, menuitemradio) are checked when the view’s checked, or else its on, is truthy. Instances without a role are not exposed; their children take their place in the tree. An assistive technology’s invoke action does what a click does, and its value change on a range writes the instance’s value as a state patch would. A runtime MUST expose these through the platform’s accessibility API (UI Automation, NSAccessibility, AT-SPI, Android accessibility) or, on the web, through ARIA attributes.