Skip to content

Commit

Permalink
Autofocus join call button when ready
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlong committed Feb 4, 2022
1 parent 9c3e490 commit ec44742
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/room/LobbyView.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from "react";
import React, { useEffect, useRef } from "react";
import styles from "./LobbyView.module.css";
import { Button, CopyButton, MicButton, VideoButton } from "../button";
import { Header, LeftNav, RightNav, RoomHeaderInfo } from "../Header";
Expand Down Expand Up @@ -43,6 +43,14 @@ export function LobbyView({

useLocationNavigation(state === GroupCallState.InitializingLocalCallFeed);

const joinCallButtonRef = useRef();

useEffect(() => {
if (state === GroupCallState.LocalCallFeedInitialized) {
joinCallButtonRef.current.focus();
}
}, [state]);

return (
<div className={styles.room}>
<Header>
Expand Down Expand Up @@ -103,6 +111,7 @@ export function LobbyView({
)}
</div>
<Button
ref={joinCallButtonRef}
className={styles.copyButton}
size="lg"
disabled={state !== GroupCallState.LocalCallFeedInitialized}
Expand Down

0 comments on commit ec44742

Please sign in to comment.