Skip to content


JavaScript library to help modern web applications with accessibility concerns by making accessibility simpler

# ally.observe.interactionType

Observes user interaction method to distinguish pointer and keyboard actions.

# Description

Observes keyboard-, pointer-, mouse- and touch-events so that a query for the current interaction type can be made at any time. For pointer interaction this observer is limited to pointer button down/up - move is not observed!

# Usage

var handle = ally.observe.interactionType();
// stop observing

// query current interaction type
var type = handle.get();

# Returns

A <global-service> interface, providing the handle.disengage() method to stop the service.

# Service handle

The handle is returned when engaging the service. As the <global-service> interface describes, the handle.disengage() method is provided to stop the service. Additionally the following methods are made available:

# handle.get()

The handle.get() method does not accept any arguments and returns an object with the following properties:

Name Type Description
key boolean true if any key is currently pressed.
pointer boolean true if any mouse button (or pointer, or touch) is currently pressed.

# Contributing