aom icon indicating copy to clipboard operation
aom copied to clipboard

Element activation and synthesized events

Open chrisosaurus opened this issue 4 years ago • 2 comments

This came up when discussing synthesizing an event from AT to represent Activation in #166.

If you have an HTML button with focus then some keypresses (Enter, Space) will synthesize a Click event in addition to the keyboard event.

  1. Which elements have activation behaviors triggered by keyboard events ?
    1. What are these keyboard events ?
    2. Where is this specified ?
  2. Should this be generalized to support non-built-in elements, and if so, how ?
  3. How should this behave for synthesized activation events sent from AT ?

chrisosaurus avatar Sep 02 '20 04:09 chrisosaurus

Some existing elements and their behavior

Element behavior on Click behavior on Enter behavior on Space
<input type=’button’></input> Click event Click and Enter events Click and Space events
<div role=’button’></div> Click event Enter event Space event
<div></div> Click event Enter event Space event
<a href=’...’></a> Open link Open link Space event

chrisosaurus avatar Sep 02 '20 05:09 chrisosaurus

Related links:

Non-click activation behaviours must, by default, fire a Click event. https://html.spec.whatwg.org/multipage/interaction.html#activation

The activation triggers for <a> elements are Click and Enter. https://w3c.github.io/uievents/#event-flow-activation

Space and Enter dispatch a Click event when a state-changing element has focus. https://w3c.github.io/uievents/#event-type-keydown

WHATWG bug “Need a consistent set of events that defines user activation” https://github.com/whatwg/html/issues/3849

chrisosaurus avatar Sep 02 '20 05:09 chrisosaurus