Accessibility/TextImplementation

From MozillaWiki
Jump to navigation Jump to search

Propose

Provide text interface implementation consistent with keyboard navigation

Current state

Text of the accessible is exposed as a string having embedded object characters which point to nested accessible. Nested accessible may be a text accessibles. In order to get next character or word the AT should crawl the tree until they get a real character or word. While this approach is suboptimal but the main problem is the text received from tree inspection is not necessary consistent with keyboard navigation in general.

Let's consider an example: text<a>link</a>text and text<a>a link</a>text, both are exposed as textXtext where X is embedded object character. Text implementation relying on embedded character approach expose three words. From keyboard navigation point of view these examples have one and two words respectively. If AT doesn't make any assumption what the word can be based on tree inspection then no way to get words in consistent way with keyboard navigation.

Proposal

Unroll recursively embedded characters into one string for every text accessible. HyperLink interface provides an access to direct embedded objects.

For example,

hello

text<a>link</a>

has "hellotextlink" text, for the container accessible containing paragraph elements there are two embedded objects having offsets [0, 5) and [5, 13). Second paragraph has "textlink" text and have one embedded object [4, 8).