Confirmed users
1,396
edits
Line 735: | Line 735: | ||
==== | ====Change the position==== | ||
There is a bunch of methods to change accessible position. | |||
<code> | <code> | ||
Line 745: | Line 747: | ||
:::''offset'' of ''Offsest'', optional | :::''offset'' of ''Offsest'', optional | ||
::::offset relative the anchor | ::::offset relative the anchor | ||
:::Return itself. | :::Return itself or null if not succeeded. | ||
Line 755: | Line 757: | ||
:::''offset'' of ''long'' | :::''offset'' of ''long'' | ||
::::offset relative the anchor | ::::offset relative the anchor | ||
:::Return itself. | :::Return itself or null if not succeeded. | ||
Line 763: | Line 765: | ||
:::''point'' of ''DOMPoint'' | :::''point'' of ''DOMPoint'' | ||
::::the point the accessible position should be moved to. | ::::the point the accessible position should be moved to. | ||
:::Return itself. | :::Return itself or null if not succeeded. | ||
====Move through the content==== | |||
Accessible position can be moved through the content by criteria. | |||
AccessiblePos .''move''(Where, | AccessiblePos .''move''(Where, Criteria) | ||
::Move the accessible position to the content | ::Move the accessible position to the content complying with criteria. | ||
::Parameters | ::Parameters | ||
:::''where'' of ''Where'' | :::''where'' of ''Where'' | ||
Line 773: | Line 779: | ||
:::''controller'' of ''Controller'' | :::''controller'' of ''Controller'' | ||
::::function describing a match | ::::function describing a match | ||
:::Return itself. | :::Return itself if succeeded, otherwise null. | ||
AccessiblePos .''search''(Where, | AccessiblePos .''search''(Where, Criteria) | ||
:: | ::Search for content of the given criteria relative the accessible position. | ||
::Parameters | ::Parameters | ||
:::''where'' of ''Where'' | :::''where'' of ''Where'' | ||
Line 783: | Line 789: | ||
:::''controller'' of ''Controller'' | :::''controller'' of ''Controller'' | ||
::::function describing a match | ::::function describing a match | ||
:::Return new instance. | :::Return new instance if succeeded, otherwise null. | ||
</code> | </code> | ||
=====Search area===== | |||
Methods traverse the accessible elements and runs the criteria function against each traversee for a match. The traversal is performed either by accessible tree hierarchy or by accessible elements layout on the screen what depends on <code>Where</code> argument. | |||
<pre> | <pre> | ||
enum Where { "forward", | enum Where { | ||
"forward", | |||
"backward", | |||
"cyclic forward", | |||
"cyclic backward", | |||
"tofirst", | |||
"tolast", | |||
"left", | |||
"right", | |||
"up", | |||
"down", | |||
"above", | |||
"under", | |||
"closest" | |||
}; | }; | ||
</pre> | </pre> | ||
Line 848: | Line 860: | ||
Examples: | Examples: | ||
<pre> | <pre> | ||
function | function criteria(el) { } | ||
var pos1 = new A11ePos(new DOMPoint(x, y), a11edoc).move("forward", | var pos1 = new A11ePos(new DOMPoint(x, y), a11edoc).move("forward", criteria); | ||
var pos2 = new A11ePos(elm, "at").move("backward", | var pos2 = new A11ePos(elm, "at").move("backward", criteria); | ||
var pos3 = new A11ePos(pos).move("forward", | var pos3 = new A11ePos(pos).move("forward", criteria); | ||
or | or | ||
var pos2 = pos2.search("forward", | var pos2 = pos2.search("forward", criteria); | ||
</pre> | </pre> | ||
===== | =====Criteria function===== | ||
<pre> | <pre> |