Accessibility/WebAccessibilityAPI: Difference between revisions

Line 1,035: Line 1,035:
==Geometry==
==Geometry==


Outline can be drawn around a range defined by two positions.
The section contains bunch of methods and approaches to deal with web page geometry.
 
===Outline===
 
AT can outline a position or a range enclosed between two positions. This feature is useful to track stuff like virtual cursor.
<pre>
<pre>
partial interface AccessibleDocument {
partial interface AccessibleDocument {
   void outline(AccessiblePos pos1, AccessiblePos pos2);
   void outline(AccessiblePos pos1, optional AccessiblePos pos2);
   void clearOutlines();
   void clearOutlines();
};
};
</pre>
</pre>


<code>
<code>
AccessibleDocument .''outline''
AccessibleDocument .''outline''
::Outlines a range bounded by two positions.
::Outlines a position if second position is omitted. If second position is omitted then outlines a collapsed range.


AccessibleDocument .''clearOutlines''
AccessibleDocument .''clearOutlines''
Line 1,052: Line 1,055:
</code>
</code>


===Geometrical navigation===


AT can scan the web page by moving the position geometrically up/down/left/right.
<pre>
<pre>
partial interface AccessiblePos {
var scanner
   readonly attribute DOMPoint coordinate;
{
  readonly attribute unsigned long distanceBetween(AccessiblePos pos2);
   start: function() {
};
    if (this.stopped)
</pre>
      return;


<code>
    var nextpos = this.pos.move("right", this.controller);
AccessiblePos .''coordinate''
    if (!nextpos)
::Returns a DOM point for top left corner of the accessible position.
      nextpos = this.pos.move("down", this.controller);
</code>


<code>
    if (nextpos) {
AccessiblePos .''distanceBetween''
      document.outline(nextpos);
::Returns a distance between this and given accessible position.
      window.setTimeout(this.start.bing(this), 1000);
</code>
    }
  },
  stop: function() {
    this.stopped = true;
  },


  controller: function(aEl) {
    var role = document.a11ement.taxonOf("role", aElm.role);
    if (role.is("widget"))
      return "at";


Questions/concerns
    return "next";
*It's tricky how to style that but maybe document or accessible should decide how it should be styled, for example, black outline on black background.
  }
  pos: new A11ePos(new DOMPoint(0, 0)),
  stopped: false
}
</pre>


===Hit testing===
===Hit testing===
Line 1,096: Line 1,112:
</pre>
</pre>


[
#Hit testing on touch pads needs to find closest accessible in some local area. We may have strict (current implementation of modern APIs) and not strict modes. Mouse may need to work in not strict mode if operated by person with motor disability.


#Also it would need a history of movement (previous coordinates) to make right decision. If you move from up to down then you want to pick up next element vs previous one (geometry part).
Questions/concerns
 
*Outline: it's tricky to style that but maybe document or accessible should decide how it should be styled, for example, black outline on black background.
#We might need to have scanning feature, from left/right/up/down to right/left/down/up and semantic scanning from start to end. (geometry part)
*Do we need a way to return coordinates of accessible position's edge points?
].
*Do we need a method to calculate distance between two positions?
*Do we need a method to calculate boundaries (aka containing rect)?
*Do we need a method to check whether the given point is contained by a range?


==Events==
==Events==
Confirmed users
1,396

edits