landscape: allow autofocusing ship select

Fixes #3804
This commit is contained in:
Tyler Brown Cifu Shuster 2020-10-27 07:52:29 -07:00
parent e6df199fff
commit d1aa23d22e
3 changed files with 6 additions and 1 deletions

View File

@ -22,6 +22,7 @@ interface RenderChoiceProps<C> {
}
interface DropdownSearchProps<C> {
autoFocus?: boolean;
label?: string;
id: string;
// check if entry is exact match
@ -51,7 +52,7 @@ interface DropdownSearchProps<C> {
export function DropdownSearch<C>(props: DropdownSearchProps<C>) {
const textarea = useRef<HTMLTextAreaElement>();
const { candidates, getKey, caption } = props;
const { candidates, getKey, caption, autoFocus } = props;
const [query, setQuery] = useState("");
@ -127,6 +128,7 @@ export function DropdownSearch<C>(props: DropdownSearchProps<C>) {
value={query}
autocomplete="off"
placeholder={props.placeholder || ""}
autoFocus={autoFocus}
/>
)}
{dropdown.length !== 0 && query.length !== 0 && (

View File

@ -12,6 +12,7 @@ import { Rolodex, Groups } from "~/types";
import { HoverBox } from "./HoverBox";
interface InviteSearchProps {
autoFocus?: boolean;
disabled?: boolean;
label?: string;
caption?: string;
@ -138,6 +139,7 @@ export function ShipSearch(props: InviteSearchProps) {
renderChoice={({ candidate, onRemove }) => null}
value={undefined}
error={error}
autoFocus={props.autoFocus}
/>
<Row minHeight="34px" flexWrap="wrap">
{value.map((s) => (

View File

@ -110,6 +110,7 @@ export function InvitePopover(props: InvitePopoverProps) {
id="ships"
label=""
maxLength={props.workspace.type === 'home' ? 1 : undefined}
autoFocus
/>
<FormError message="Failed to invite" />
{/* <ChipInput