mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
Guard against null refs in findSiblingElement (#7228)
This commit is contained in:
parent
1d2965a111
commit
766d1ee3e8
1 changed files with 2 additions and 2 deletions
|
@ -165,13 +165,13 @@ export const findSiblingElement = (
|
||||||
): RefObject<HTMLElement> => {
|
): RefObject<HTMLElement> => {
|
||||||
if (backwards) {
|
if (backwards) {
|
||||||
for (let i = startIndex; i < refs.length && i >= 0; i--) {
|
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];
|
return refs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let i = startIndex; i < refs.length && i >= 0; i++) {
|
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];
|
return refs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue