Accessibility/WebAccessibilityAPI: Difference between revisions

Line 1,041: Line 1,041:
==Events==
==Events==


The accessible element may fire various number of events. You can add event listener on document accessible to handle all events from accessible elements of the document.
The accessible element may fire various number of events. You can add event listener on document accessible to handle all events from accessible elements belonging to the document.


<pre>
<pre>
Line 1,082: Line 1,082:
::Extra attributes used to describe the event. Used for certain event types.
::Extra attributes used to describe the event. Used for certain event types.
</code>
</code>
<b>Example. Live regions processing.</b>
<pre>
function handleLiveRegion(aEvent)
{
  var attrs =
    { live: "assertive", relevant: "change:name" };
  if (aEvent.attributes.hasAllOf(attrs)) {
    say(aEvent.target.name);
  }
}
document.a11ement.on("change:name");
</pre>




Line 1,091: Line 1,107:
"focus"
"focus"
::Fired when accessible element is focused.
::Fired when accessible element is focused.
</code>


<code>
"caretmove"
"caretmove"
::Fired when caret is moved within the document.
::Fired when caret is moved within the document.
"change:name"
::Fired when name property is changed.
</code>
</code>


Confirmed users
1,396

edits