diff --git a/ui/src/admin/components/influxdb/CreateRoleDialog.tsx b/ui/src/admin/components/influxdb/CreateRoleDialog.tsx index 6ed6312fe..ecf1da2c4 100644 --- a/ui/src/admin/components/influxdb/CreateRoleDialog.tsx +++ b/ui/src/admin/components/influxdb/CreateRoleDialog.tsx @@ -25,6 +25,15 @@ const CreateRoleDialog = ({visible, setVisible, create}: Props) => { setName('') setVisible(false) }, []) + const onEnterPressed = useCallback( + (e: React.KeyboardEvent) => { + if (e.key === 'Enter' && name) { + e.stopPropagation() + create({name}) + } + }, + [name, create] + ) return ( @@ -38,6 +47,7 @@ const CreateRoleDialog = ({visible, setVisible, create}: Props) => { autoFocus={true} autoComplete="off" onChange={e => setName(e.target.value)} + onKeyPress={onEnterPressed} status={ validateRoleName(name) ? ComponentStatus.Valid