- commit
- 18eee65d74f442228f8090b0363190d8cfea1a55
- parent
- d58b5b8dd41691598db31a26e49879fcb7ef88ce
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-06-22 20:24
name: fallback to tooltip for any element
Diffstat
| M | lib/name.js | 3 | +-- |
| M | test/test-name.js | 6 | ------ |
2 files changed, 1 insertions, 8 deletions
diff --git a/lib/name.js b/lib/name.js
@@ -167,8 +167,7 @@ const getName = function(el, recursive, visited, directReference) {
167 167 // handled in getContent
168 168
169 169 // I
170 -1 // FIXME: presentation not mentioned in the spec
171 -1 if (!ret.trim() && (directReference || !query.matches(el, 'presentation'))) {
-1 170 if (!ret.trim()) {
172 171 ret = el.title || el.placeholder || '';
173 172 }
174 173
diff --git a/test/test-name.js b/test/test-name.js
@@ -14,10 +14,4 @@ describe('getName / getDescription', () => {
14 14 var element = document.querySelector('#test');
15 15 expect(aria.getName(element)).toBe('test');
16 16 });
17 -1
18 -1 it('ignores <img alt="">', () => {
19 -1 testbed.innerHTML = '<img id="test" alt="" title="title">'
20 -1 var element = document.querySelector('#test');
21 -1 expect(aria.getName(element)).toBe('');
22 -1 });
23 17 });