diff --git a/src/accessibility/RovingTabIndex.tsx b/src/accessibility/RovingTabIndex.tsx index 51cc2322d1..a7f8f735ce 100644 --- a/src/accessibility/RovingTabIndex.tsx +++ b/src/accessibility/RovingTabIndex.tsx @@ -165,13 +165,13 @@ export const findSiblingElement = ( ): RefObject => { if (backwards) { for (let i = startIndex; i < refs.length && i >= 0; i--) { - if (refs[i].current.offsetParent !== null) { + if (refs[i].current?.offsetParent !== null) { return refs[i]; } } } else { for (let i = startIndex; i < refs.length && i >= 0; i++) { - if (refs[i].current.offsetParent !== null) { + if (refs[i].current?.offsetParent !== null) { return refs[i]; } }