From 519a9ca493cbd64ebf5f69a88d5e6036f8932ce8 Mon Sep 17 00:00:00 2001 From: Mohit kumar Bajoria Date: Fri, 17 Apr 2020 01:32:59 +0530 Subject: [PATCH] Close sharing dialog on Enter when changing the username (#1437) --- src/components/RoomDialog.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/RoomDialog.tsx b/src/components/RoomDialog.tsx index daef6100..a2e48d24 100644 --- a/src/components/RoomDialog.tsx +++ b/src/components/RoomDialog.tsx @@ -15,12 +15,14 @@ function RoomModal({ onUsernameChange, onRoomCreate, onRoomDestroy, + onPressingEnter, }: { activeRoomLink: string; username: string; onUsernameChange: (username: string) => void; onRoomCreate: () => void; onRoomDestroy: () => void; + onPressingEnter: () => void; }) { const roomLinkInput = useRef(null); @@ -85,6 +87,7 @@ function RoomModal({ value={username || ""} className="RoomDialog-username TextInput" onChange={(event) => onUsernameChange(event.target.value)} + onKeyPress={(event) => event.key === "Enter" && onPressingEnter()} />

{`🔒 ${t("roomDialog.desc_privacy")}`}

@@ -173,6 +176,7 @@ export function RoomDialog({ onUsernameChange={onUsernameChange} onRoomCreate={onRoomCreate} onRoomDestroy={onRoomDestroy} + onPressingEnter={handleClose} /> )}