aom
aom copied to clipboard
Element activation and synthesized events
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.
- Which elements have activation behaviors triggered by keyboard events ?
- What are these keyboard events ?
- Where is this specified ?
- Should this be generalized to support non-built-in elements, and if so, how ?
- How should this behave for synthesized activation events sent from AT ?
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 |
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