- commit
- 0262b17a4dad16ae2dac313e2f617b24ef29fb97
- parent
- 783907299ed343c3891f23899eb3b937d680827b
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2023-06-07 11:25
add incomplete support for svg-aam-1.0
Diffstat
| M | README.md | 1 | + |
| M | lib/constants.js | 4 | ++++ |
| M | lib/name.js | 11 | +++++++++++ |
3 files changed, 16 insertions, 0 deletions
diff --git a/README.md b/README.md
@@ -108,6 +108,7 @@ That said, this is what I think it could also be used for: 108 108 109 109 - [Accessible Rich Internet Applications 1.2](https://www.w3.org/TR/wai-aria-1.2/) 110 110 - [HTML Accessibility API Mappings 1.0](https://www.w3.org/TR/html-aam-1.0/) -1 111 - [SVG Accessibility API Mappings](https://www.w3.org/TR/svg-aam-1.0/) (very incomplete) 111 112 - [WAI-ARIA Graphics Module 1.0](https://www.w3.org/TR/graphics-aria-1.0/) 112 113 - [Digital Publishing WAI-ARIA Module 1.1](https://www.w3.org/TR/dpub-aria-1.1/) 113 114 - [Accessible Name and Description Computation 1.1](https://www.w3.org/TR/accname-1.1/)
diff --git a/lib/constants.js b/lib/constants.js
@@ -201,6 +201,9 @@ exports.roles = {
201 201 generic: {
202 202 // too many selectors to list
203 203 },
-1 204 'graphics-document': {
-1 205 selectors: ['svg'],
-1 206 },
204 207 grid: {
205 208 childRoles: ['treegrid'],
206 209 },
@@ -215,6 +218,7 @@ exports.roles = {
215 218 'fieldset',
216 219 'hgroup',
217 220 'optgroup',
-1 221 'text',
218 222 ],
219 223 childRoles: ['row', 'select', 'toolbar', 'graphics-object'],
220 224 },
diff --git a/lib/name.js b/lib/name.js
@@ -111,6 +111,12 @@ var getName = function(el, recursive, visited, directReference) {
111 111 }
112 112 }
113 113 }
-1 114 if (!ret.trim() && el.matches('svg *')) {
-1 115 var svgTitle = el.querySelector('title');
-1 116 if (svgTitle && svgTitle.parentElement === el) {
-1 117 ret = svgTitle.textContent;
-1 118 }
-1 119 }
114 120
115 121 // E
116 122 if (!ret.trim() && (recursive || isInLabelForOtherWidget(el) || query.matches(el, 'button'))) {
@@ -180,6 +186,11 @@ var getDescription = function(el) {
180 186 ret = strings.join(' ');
181 187 } else if (el.matches('[aria-description]')) {
182 188 ret = el.getAttribute('aria-description');
-1 189 } else if (el.matches('svg *')) {
-1 190 var svgDesc = el.querySelector('desc');
-1 191 if (svgDesc && svgDesc.parentElement === el) {
-1 192 ret = svgDesc.textContent;
-1 193 }
183 194 } else if (el.title) {
184 195 ret = el.title;
185 196 }