Skip to content

Commit 7f8de89

Browse files
briandipalmaKent C. Dodds
authored and
Kent C. Dodds
committed
fix: shouldExcludeFromA11yTree runs in IE11 (#365)
IE11 returns `undefined` for missing `parentElement`.
1 parent 1233db0 commit 7f8de89

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/__tests__/element-queries.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ test('queryAllByRole returns semantic html elements', () => {
385385
<h4>Heading 4</h4>
386386
<h5>Heading 5</h5>
387387
<h6>Heading 6</h6>
388+
<svg role="img">
389+
<rect width="100" height="100" />
390+
</svg>
388391
<ol>
389392
<li></li>
390393
<li></li>
@@ -429,6 +432,7 @@ test('queryAllByRole returns semantic html elements', () => {
429432
expect(queryAllByRole('row')).toHaveLength(3)
430433
expect(queryAllByRole(/rowgroup/i)).toHaveLength(2)
431434
expect(queryAllByRole(/(table)|(textbox)/i)).toHaveLength(3)
435+
expect(queryAllByRole(/img/i)).toHaveLength(1)
432436
})
433437

434438
test('getAll* matchers return an array', () => {

src/role-helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function shouldExcludeFromA11yTree(element) {
2626
let visibility = computedStyle.visibility
2727

2828
let currentElement = element
29-
while (currentElement !== null) {
29+
while (currentElement) {
3030
if (currentElement.hidden === true) {
3131
return true
3232
}

0 commit comments

Comments
 (0)