Skip to content

Commit 31c56b5

Browse files
committed
refactor: use optional chaining
1 parent 71a1e81 commit 31c56b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/role-helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function isSubtreeInaccessible(element: Element) {
4141
}
4242

4343
const window = element.ownerDocument.defaultView
44-
if (window && window.getComputedStyle(element).display === 'none') {
44+
if (window?.getComputedStyle(element).display === 'none') {
4545
return true
4646
}
4747

@@ -68,7 +68,7 @@ function isInaccessible(element: Element, options: InaccessibleOptions = {}) {
6868
} = options
6969
const window = element.ownerDocument.defaultView
7070
// since visibility is inherited we can exit early
71-
if (window && window.getComputedStyle(element).visibility === 'hidden') {
71+
if (window?.getComputedStyle(element).visibility === 'hidden') {
7272
return true
7373
}
7474

0 commit comments

Comments
 (0)