diff --git a/src/components/views/rooms/RoomList.tsx b/src/components/views/rooms/RoomList.tsx index e2550bc2b6e..9251cfc2ba6 100644 --- a/src/components/views/rooms/RoomList.tsx +++ b/src/components/views/rooms/RoomList.tsx @@ -616,11 +616,8 @@ export default class RoomList extends React.PureComponent { public focus(): void { // focus the first focusable element in this aria treeview widget const treeItems = this.treeRef.current?.querySelectorAll('[role="treeitem"]'); - if (treeItems) { - return; - } - [...treeItems] - .find(e => e.offsetParent !== null)?.focus(); + if (!treeItems) return; + [...treeItems].find(e => e.offsetParent !== null)?.focus(); } public render() {