A11yance / aria-query

Programmatic access to the ARIA specification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support `rowheader` role when `<th scope='rowgroup'>`

wasanx25 opened this issue · comments

Relates to testing-library/dom-testing-library#930

Hi there.

Now the role of <th scope='rowgroup'> is columnheader. According above issue it treat regard to as rowheader in Chrome and Firefox.

I'm not honestly confidence but should fix issue?
Thanks,

If you don't mind I will edit as below.

diff --git a/scripts/roles.json b/scripts/roles.json
index 08e47ba..1a26e1a 100644
--- a/scripts/roles.json
+++ b/scripts/roles.json
@@ -4686,9 +4686,21 @@
           "name": "th"
         },
         "module": "HTML"
+      },
+      {
+        "concept": {
+          "attributes": [
+            {
+              "name": "scope",
+              "value": "rowgroup"
+            }
+          ],
+          "name": "th"
+        },
+        "module": "HTML"
       }
     ],
-    "requiredContextRole": ["row"],
+    "requiredContextRole": ["row", "rowgroup"],
     "requiredOwnedElements": [],
     "requiredProps": [],
     "superClass": ["cell", "gridcell", "sectionhead"]
diff --git a/src/etc/roles/literal/rowheaderRole.js b/src/etc/roles/literal/rowheaderRole.js
index db610dd..edb2383 100644
--- a/src/etc/roles/literal/rowheaderRole.js
+++ b/src/etc/roles/literal/rowheaderRole.js
@@ -27,12 +27,26 @@ const rowheaderRole: ARIARoleDefinition = {
       },
       module: 'HTML',
     },
+    {
+      concept: {
+        attributes: [
+          {
+            name: 'scope',
+            value: 'rowgroup',
+          },
+        ],
+        name: 'th',
+      },
+      module: 'HTML',
+    },
   ],
   requireContextRole: [
     'row',
+    'rowgroup',
   ],
   requiredContextRole: [
     'row',
+    'rowgroup',
   ],
   requiredOwnedElements: [],
   requiredProps: {},