From eecf775fef6ed691cc96f1f348634a5e221fb7da Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Mon, 18 Dec 2023 22:21:48 -0500 Subject: [PATCH 01/13] Specify a locator for accessible role --- index.bs | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/index.bs b/index.bs index 2dab3aa0..290f94ab 100644 --- a/index.bs +++ b/index.bs @@ -269,6 +269,9 @@ 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/ + type: dfn + text: WAI-ARIA role; url: #introroles
@@ -2501,6 +2504,7 @@ To await a navigation given |context|, |request|, |wait condition|, a
 browsingContext.Locator = (
    browsingContext.CssLocator /
    browsingContext.InnerTextLocator /
+   browsingContext.RoleLocator /
    browsingContext.XPathLocator
 )
 
@@ -2517,6 +2521,11 @@ browsingContext.InnerTextLocator = {
    ? maxDepth: js-uint,
 }
 
+browsingContext.RoleLocator = {
+   type: "role",
+   value: text
+}
+
 browsingContext.XPathLocator = {
    type: "xpath",
    value: text
@@ -3406,6 +3415,41 @@ and |session|:
 
 
 
+
+To locate nodes using role with given |context nodes|, |selector|, +|maximum returned node count|, and |session|: + +1. If |selector| is the empty string, 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. If |selector| [=is=] |role|: + + 1. [=list/Append=] |context node| to |returned nodes|. + + 1. Let |child nodes| be an empty [=/list=] and, for each node |child| in the + children of |context node|: + + 1. If |child| implements {{Element}}, [=list/append=] |child| to |child nodes|. + + 1. Let |child node matches| be the result of [=locate nodes using role=] + with |child nodes|, |selector|, |maximum returned node count|, and |session|. + + 1. [=list/Extend=] |returned nodes| with |child node matches|. + +1. If |maximum returned node count| is not null, [=list/remove=] all entries + in |returned nodes| with an index greater than or equal to |maximum returned + node count|. + +1. Return [=success=] with data |returned nodes|. + +
+
The [=remote end steps=] with |session| and |command parameters| are: @@ -3482,6 +3526,14 @@ The [=remote end steps=] with |session| and |command parameters| are: given |context nodes|, |selector|, |max depth|, |match type|, |ignore case|, |maximum returned node count| and |session|. +
|type| is the string "role" +
+ 1. Let |selector| be |locator|["value"]. + + 1. Let |result nodes| be a result of [=trying=] to [=locate nodes using role=] + given |context nodes|, |selector|, |maximum returned node count| and + |session|. + 1. Assert: |maximum returned node count| is null or [=list/size=] of |result nodes| is less than or equal to |maximum returned node count|. From 875ad2e7fef29a5d07485da78c51f36ed5eb302e Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Tue, 13 Feb 2024 10:49:40 +0100 Subject: [PATCH 02/13] generalize to accessible attributes --- index.bs | 79 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/index.bs b/index.bs index 290f94ab..93a96de3 100644 --- a/index.bs +++ b/index.bs @@ -269,9 +269,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
@@ -2502,12 +2505,20 @@ To await a navigation given |context|, |request|, |wait condition|, a
 
 
 browsingContext.Locator = (
+   browsingContext.AccessibilityLocator /
    browsingContext.CssLocator /
    browsingContext.InnerTextLocator /
-   browsingContext.RoleLocator /
    browsingContext.XPathLocator
 )
 
+browsingContext.AccessibilityLocator = {
+   type: "accessibility",
+   value: {
+    ? name: text,
+    ? role: text,
+   }
+}
+
 browsingContext.CssLocator = {
    type: "css",
    value: text
@@ -2521,11 +2532,6 @@ browsingContext.InnerTextLocator = {
    ? maxDepth: js-uint,
 }
 
-browsingContext.RoleLocator = {
-   type: "role",
-   value: text
-}
-
 browsingContext.XPathLocator = {
    type: "xpath",
    value: text
@@ -3415,20 +3421,43 @@ and |session|:
 
 
 
-
-To locate nodes using role with given |context nodes|, |selector|, -|maximum returned node count|, and |session|: +
+To locate nodes using accessibility attributes with given |context nodes|, |selector|, +|maximum returned node count|, |session|, and |returned nodes|: -1. If |selector| is the empty string, return [=error=] with [=error code=] +1. If |selector|'s role and |selector|'s name are missing, return [=error=] with [=error code=] [=invalid selector=]. -1. Let |returned nodes| be an empty [=/list=]. +1. If |returned nodes| is null: + + 1. Set |returned nodes| to an empty [=/list=]. + +1. If |maximum returned node count| is not null and [=list/size=] of |returned + nodes| is greater or equal to |maximum returned node count|: + + 1. Return [=success=] with data null. 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 role is present: + + 1. Let |role| be the result of computing the [=accessible role=] of |context node|. - 1. If |selector| [=is=] |role|: + 1. If |selector|'s role [=is|is not=] |role|: + + 1. Set |match| to false. + + 1. If |selector|'s name is present: + + 1. Let |name| be the result of computing the [=accessible name=] of |context node|. + + 1. If |selector|'s name [=is|is not=] |name|: + + 1. Set |match| to false. + + 1. If |match| is true: 1. [=list/Append=] |context node| to |returned nodes|. @@ -3437,16 +3466,8 @@ To locate nodes using role 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=] - with |child nodes|, |selector|, |maximum returned node count|, and |session|. - - 1. [=list/Extend=] |returned nodes| with |child node matches|. - -1. If |maximum returned node count| is not null, [=list/remove=] all entries - in |returned nodes| with an index greater than or equal to |maximum returned - node count|. - -1. Return [=success=] with data |returned nodes|. + 1. Invoke [=locate nodes using accessibility attributes=] with |child nodes|, + |selector|, |maximum returned node count|, |session|, and |returned nodes|.
@@ -3526,13 +3547,13 @@ The [=remote end steps=] with |session| and |command parameters| are: given |context nodes|, |selector|, |max depth|, |match type|, |ignore case|, |maximum returned node count| and |session|. -
|type| is the string "role" +
|type| is the string "accessibility"
1. Let |selector| be |locator|["value"]. - 1. Let |result nodes| be a result of [=trying=] to [=locate nodes using role=] - given |context nodes|, |selector|, |maximum returned node count| and - |session|. + 1. Let |result nodes| be a result of [=trying=] to [=locate nodes using accessibility attributes=] + given |context nodes|, |selector|, |maximum returned node count|, + |session|, and null. 1. Assert: |maximum returned node count| is null or [=list/size=] of |result nodes| is less than or equal to |maximum returned node count|. From 94cc3dc689f676ea7d2ded7bece4bb1abc1da64c Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Tue, 19 Mar 2024 12:53:39 +0100 Subject: [PATCH 03/13] refactor based on comments --- index.bs | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/index.bs b/index.bs index 93a96de3..0dc01b7b 100644 --- a/index.bs +++ b/index.bs @@ -3421,29 +3421,21 @@ and |session|:
-
-To locate nodes using accessibility attributes with given |context nodes|, |selector|, -|maximum returned node count|, |session|, and |returned nodes|: - -1. If |selector|'s role and |selector|'s name are missing, return [=error=] with [=error code=] - [=invalid selector=]. +
+To collect nodes using accessibility attributes with given |context nodes|, |selector|, +|maximum returned node count|, and |returned nodes|: 1. If |returned nodes| is null: 1. Set |returned nodes| to an empty [=/list=]. -1. If |maximum returned node count| is not null and [=list/size=] of |returned - nodes| is greater or equal to |maximum returned node count|: - - 1. Return [=success=] with data null. - 1. For each |context node| in |context nodes|: 1. Let |match| be true. 1. If |selector|'s role is present: - 1. Let |role| be the result of computing the [=accessible role=] of |context node|. + 1. Let |role| be the [=accessible role=] of |context node|. 1. If |selector|'s role [=is|is not=] |role|: @@ -3451,7 +3443,7 @@ To locate nodes using accessibility attributes with given |context no 1. If |selector|'s name is present: - 1. Let |name| be the result of computing the [=accessible name=] of |context node|. + 1. Let |name| be the [=accessible name=] of |context node|. 1. If |selector|'s name [=is|is not=] |name|: @@ -3459,6 +3451,11 @@ To locate nodes using accessibility attributes with given |context no 1. If |match| is true: + 1. If |maximum returned node count| is not null and [=list/size=] of |returned + nodes| is greater or equal to |maximum returned node count|: + + 1. Return [=success=] with data |returned nodes|. + 1. [=list/Append=] |context node| to |returned nodes|. 1. Let |child nodes| be an empty [=/list=] and, for each node |child| in the @@ -3466,8 +3463,23 @@ To locate nodes using accessibility attributes with given |context no 1. If |child| implements {{Element}}, [=list/append=] |child| to |child nodes|. - 1. Invoke [=locate nodes using accessibility attributes=] with |child nodes|, - |selector|, |maximum returned node count|, |session|, and |returned nodes|. + 1. Invoke [=collect nodes using accessibility attributes=] with |child nodes|, + |selector|, |maximum returned node count|, and |returned nodes|. + + 1. Return [=success=] with data |returned nodes|. + +
+ +
+To locate nodes using accessibility attributes with given |context nodes|, |selector|, and +|maximum returned node count|: + +1. If |selector|'s role and |selector|'s name + are missing, return [=error=] with [=error code=] + [=invalid selector=]. + +1. Return the result of [=collect nodes using accessibility attributes=] with |context nodes|, + |selector|, |maximum returned node count|, and null.
@@ -3552,8 +3564,7 @@ The [=remote end steps=] with |session| and |command parameters| are: 1. Let |selector| be |locator|["value"]. 1. Let |result nodes| be a result of [=trying=] to [=locate nodes using accessibility attributes=] - given |context nodes|, |selector|, |maximum returned node count|, - |session|, and null. + given |context nodes|, |selector|, and |maximum returned node count|. 1. Assert: |maximum returned node count| is null or [=list/size=] of |result nodes| is less than or equal to |maximum returned node count|. From 79586a2153a1650599fdc2afd8f87521f25b2d63 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Tue, 19 Mar 2024 13:19:36 +0100 Subject: [PATCH 04/13] use computed role --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 0dc01b7b..cbeb84d2 100644 --- a/index.bs +++ b/index.bs @@ -274,7 +274,7 @@ spec: ACCNAME; urlPrefix:https://www.w3.org/TR/accname-1.2 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 + text: computed role; url: /#roleMappingComputedRole
@@ -3435,7 +3435,7 @@ To collect nodes using accessibility attributes with given |context n
 
   1. If |selector|'s role is present:
 
-    1. Let |role| be the [=accessible role=] of |context node|.
+    1. Let |role| be the [=computed role=] of |context node|.
 
     1. If |selector|'s role [=is|is not=] |role|:
 

From f4015585be0b1e25ec0cc8c0ebe9ed5743daae5b Mon Sep 17 00:00:00 2001
From: Alex Rudenko 
Date: Mon, 15 Apr 2024 12:41:32 +0200
Subject: [PATCH 05/13] Update index.bs

Co-authored-by: jgraham 
---
 index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.bs b/index.bs
index cbeb84d2..d74dab5e 100644
--- a/index.bs
+++ b/index.bs
@@ -3433,7 +3433,7 @@ To collect nodes using accessibility attributes with given |context n
 
   1. Let |match| be true.
 
-  1. If |selector|'s role is present:
+  1. If |selector| [=map/contains=] "role":
 
     1. Let |role| be the [=computed role=] of |context node|.
 

From bae944317c27e5720818e4b1f1356d16fc3920dd Mon Sep 17 00:00:00 2001
From: Alex Rudenko 
Date: Mon, 15 Apr 2024 12:42:37 +0200
Subject: [PATCH 06/13] Update index.bs

Co-authored-by: jgraham 
---
 index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.bs b/index.bs
index d74dab5e..ce6a9ebe 100644
--- a/index.bs
+++ b/index.bs
@@ -3437,7 +3437,7 @@ To collect nodes using accessibility attributes with given |context n
 
     1. Let |role| be the [=computed role=] of |context node|.
 
-    1. If |selector|'s role [=is|is not=] |role|:
+    1. If |selector|["role"] [=is|is not=] |role|:
 
       1. Set |match| to false.
 

From 90b3ecb3b0c6ce7283657a97fb0dbd6d29838d65 Mon Sep 17 00:00:00 2001
From: Alex Rudenko 
Date: Mon, 15 Apr 2024 12:42:44 +0200
Subject: [PATCH 07/13] Update index.bs

Co-authored-by: jgraham 
---
 index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.bs b/index.bs
index ce6a9ebe..8d4a9208 100644
--- a/index.bs
+++ b/index.bs
@@ -3441,7 +3441,7 @@ To collect nodes using accessibility attributes with given |context n
 
       1. Set |match| to false.
 
-  1. If |selector|'s name is present:
+  1. If |selector| [=map/contains=] "name":
 
     1. Let |name| be the [=accessible name=] of |context node|.
 

From ea0f6a4896ccba75c9648ac81c6a80138c23d8f9 Mon Sep 17 00:00:00 2001
From: Alex Rudenko 
Date: Mon, 15 Apr 2024 12:42:50 +0200
Subject: [PATCH 08/13] Update index.bs

Co-authored-by: jgraham 
---
 index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.bs b/index.bs
index 8d4a9208..02d8d17b 100644
--- a/index.bs
+++ b/index.bs
@@ -3445,7 +3445,7 @@ To collect nodes using accessibility attributes with given |context n
 
     1. Let |name| be the [=accessible name=] of |context node|.
 
-    1. If |selector|'s name [=is|is not=] |name|:
+    1. If |selector|["name"] [=is|is not=] |name|:
 
       1. Set |match| to false.
 

From 8cd269bf8440f019c765678d2a44ef36c4ae2199 Mon Sep 17 00:00:00 2001
From: Alex Rudenko 
Date: Mon, 15 Apr 2024 12:47:08 +0200
Subject: [PATCH 09/13] update map checks

---
 index.bs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/index.bs b/index.bs
index 02d8d17b..a71cb34c 100644
--- a/index.bs
+++ b/index.bs
@@ -3474,8 +3474,9 @@ To collect nodes using accessibility attributes with given |context n
 To locate nodes using accessibility attributes with given |context nodes|, |selector|, and
 |maximum returned node count|:
 
-1. If |selector|'s role and |selector|'s name
-   are missing, return [=error=] with [=error code=]
+1. If |selector| does not [=map/contain=] "role" and
+   |selector| does not [=map/contain=] "name", return
+   [=error=] with [=error code=]
    [=invalid selector=].
 
 1. Return the result of [=collect nodes using accessibility attributes=] with |context nodes|,

From bc30f504626c277b8559dc9c2340b8cbd46a3b50 Mon Sep 17 00:00:00 2001
From: Alex Rudenko 
Date: Mon, 15 Apr 2024 12:51:22 +0200
Subject: [PATCH 10/13] fix invoke

---
 index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.bs b/index.bs
index a71cb34c..c0ba244d 100644
--- a/index.bs
+++ b/index.bs
@@ -3463,7 +3463,7 @@ To collect nodes using accessibility attributes with given |context n
 
     1. If |child| implements {{Element}}, [=list/append=] |child| to |child nodes|.
 
-  1. Invoke [=collect nodes using accessibility attributes=] with |child nodes|,
+  1. [=Try=] to [=collect nodes using accessibility attributes=] with |child nodes|,
      |selector|, |maximum returned node count|, and |returned nodes|.
 
   1. Return [=success=] with data |returned nodes|.

From dde9c9371afbb31a6f4b0877c614aea1275b1f5f Mon Sep 17 00:00:00 2001
From: Alex Rudenko 
Date: Mon, 15 Apr 2024 13:23:22 +0200
Subject: [PATCH 11/13] fix return types

---
 index.bs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/index.bs b/index.bs
index c0ba244d..e02c3d9c 100644
--- a/index.bs
+++ b/index.bs
@@ -3454,7 +3454,7 @@ To collect nodes using accessibility attributes with given |context n
     1. If |maximum returned node count| is not null and [=list/size=] of |returned
       nodes| is greater or equal to |maximum returned node count|:
 
-      1. Return [=success=] with data |returned nodes|.
+      1. Return |returned nodes|.
 
     1. [=list/Append=] |context node| to |returned nodes|.
 
@@ -3466,7 +3466,10 @@ To collect nodes using accessibility attributes with given |context n
   1. [=Try=] to [=collect nodes using accessibility attributes=] with |child nodes|,
      |selector|, |maximum returned node count|, and |returned nodes|.
 
-  1. Return [=success=] with data |returned nodes|.
+  1. If |maximum returned node count| is not null and [=list/size=] of |returned
+      nodes| is greater or equal to |maximum returned node count|, break.
+
+1. Return |returned nodes|.
 
 
 

From 919f23a2d81ba9a12495f647f809e084aaae67be Mon Sep 17 00:00:00 2001
From: Alex Rudenko 
Date: Mon, 15 Apr 2024 13:26:41 +0200
Subject: [PATCH 12/13] fix break

---
 index.bs | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/index.bs b/index.bs
index e02c3d9c..8c8f3893 100644
--- a/index.bs
+++ b/index.bs
@@ -3452,9 +3452,7 @@ To collect nodes using accessibility attributes with given |context n
   1. If |match| is true:
 
     1. If |maximum returned node count| is not null and [=list/size=] of |returned
-      nodes| is greater or equal to |maximum returned node count|:
-
-      1. Return |returned nodes|.
+      nodes| is equal to |maximum returned node count|, [=break=].
 
     1. [=list/Append=] |context node| to |returned nodes|.
 
@@ -3466,9 +3464,6 @@ To collect nodes using accessibility attributes with given |context n
   1. [=Try=] to [=collect nodes using accessibility attributes=] with |child nodes|,
      |selector|, |maximum returned node count|, and |returned nodes|.
 
-  1. If |maximum returned node count| is not null and [=list/size=] of |returned
-      nodes| is greater or equal to |maximum returned node count|, break.
-
 1. Return |returned nodes|.
 
 

From b0ee3076b7e48e34756de55b90eb1fbced9f6f39 Mon Sep 17 00:00:00 2001
From: Alex Rudenko 
Date: Mon, 15 Apr 2024 14:44:17 +0200
Subject: [PATCH 13/13] Update index.bs

Co-authored-by: jgraham 
---
 index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.bs b/index.bs
index 8c8f3893..bf8327d0 100644
--- a/index.bs
+++ b/index.bs
@@ -3562,7 +3562,7 @@ The [=remote end steps=] with |session| and |command parameters| are:
       
1. Let |selector| be |locator|["value"]. - 1. Let |result nodes| be a result of [=trying=] to [=locate nodes using accessibility attributes=] + 1. Let |result nodes| be [=locate nodes using accessibility attributes=] given |context nodes|, |selector|, and |maximum returned node count|. 1. Assert: |maximum returned node count| is null or [=list/size=] of |result nodes| is less