Skip to content

Commit

Permalink
generalize to accessible attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Feb 13, 2024
1 parent ba4ce76 commit 552cfdb
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,12 @@ spec: UNICODE; urlPrefix: https://www.unicode.org/versions/Unicode15.0.0/
type: dfn
text: Unicode Default Case Conversion algorithm; url: ch03.pdf#G34944
text: toUppercase; url: ch03.pdf#G34078
spec: WAI-ARIA; urlPrefix:https://w3c.github.io/aria/
spec: ACCNAME; urlPrefix:https://www.w3.org/TR/accname-1.2
type: dfn
text: WAI-ARIA role; url: #introroles
text: accessible name; url: /#dfn-accessible-name
spec: CORE-AAM; urlPrefix:https://www.w3.org/TR/core-aam-1.2
type: dfn
text: accessible role; url: /#roleMappingComputedRole
</pre>

<pre class="biblio">
Expand Down Expand Up @@ -2190,7 +2193,7 @@ To <dfn>await a navigation</dfn> given |context|, |request|, |wait condition|, a
browsingContext.Locator = (
browsingContext.CssLocator /
browsingContext.InnerTextLocator /
browsingContext.RoleLocator /
browsingContext.AccessibilityLocator /
browsingContext.XPathLocator
)

Expand All @@ -2207,9 +2210,13 @@ browsingContext.InnerTextLocator = {
? maxDepth: js-uint,
}

browsingContext.RoleLocator = {
type: "role",
value: text
browsingContext.AccessibilityLocator = {
type: "accessibility",
value: {
? role: text,
? name: text,
Extensible
}
}

browsingContext.XPathLocator = {
Expand Down Expand Up @@ -3085,20 +3092,36 @@ and |session|:

</div>

<div algorithm="locate nodes using role">
To <dfn>locate nodes using role</dfn> with given |context nodes|, |selector|,
<div algorithm="locate nodes using accessibility attributes">
To <dfn>locate nodes using accessibility attributes</dfn> with given |context nodes|, |selector|,
|maximum returned node count|, and |session|:

1. If |selector| is the empty string, return [=error=] with [=error code=]
1. If |selector|'s <code>role</code> and |selector|'s <code>name</code> are missing, return [=error=] with [=error code=]
[=invalid selector=].

1. Let |returned nodes| be an empty [=/list=].

1. For each |context node| in |context nodes|:

1. Let |role| be the result of computing the [=WAI-ARIA role=] of |context node|.
1. Let |match| be true.

1. If |selector|'s <code>role</code> is present:

1. Let |role| be the result of computing the [=accessible role=] of |context node|.

1. If |selector|'s <code>role</code> [=is|is not=] |role|:

1. Set |match| to false.

1. If |selector|'s <code>name</code> is present:

1. Let |name| be the result of computing the [=accessible name=] of |context node|.

1. If |selector|'s <code>name</code> [=is|is not=] |name|:

1. Set |match| to false.

1. If |selector| [=is=] |role|:
1. If |match| is true:

1. [=list/Append=] |context node| to |returned nodes|.

Expand All @@ -3107,7 +3130,7 @@ To <dfn>locate nodes using role</dfn> with given |context nodes|, |selector|,

1. If |child| implements {{Element}}, [=list/append=] |child| to |child nodes|.

1. Let |child node matches| be the result of [=locate nodes using role=]
1. Let |child node matches| be the result of [=locate nodes using accessibility attributes=]
with |child nodes|, |selector|, |maximum returned node count|, and |session|.

1. [=list/Extend=] |returned nodes| with |child node matches|.
Expand Down Expand Up @@ -3205,11 +3228,11 @@ The [=remote end steps=] with |session| and |command parameters| are:
given |current context target|, |context nodes|, |selector|, |max depth|,
|match type|, |ignore case|, |maximum returned node count| and |session|.

<dt>|type| is the string "<code>role</code>"
<dt>|type| is the string "<code>accessibility</code>"
<dd>
1. Let |selector| be |locator|["<code>value</code>"].

1. Let |result nodes| be a result of [=trying=] to [=locate nodes using role=]
1. Let |result nodes| be a result of [=trying=] to [=locate nodes using accessibility attributes=]
given |context nodes|, |selector|, |maximum returned node count| and
|session|.

Expand Down

0 comments on commit 552cfdb

Please sign in to comment.