diff --git a/packages/ui/src/components/editor/input/String/index.tsx b/packages/ui/src/components/editor/input/String/index.tsx index 4f44d307c6..fe53764c76 100644 --- a/packages/ui/src/components/editor/input/String/index.tsx +++ b/packages/ui/src/components/editor/input/String/index.tsx @@ -31,9 +31,10 @@ export interface StringInputProps extends Omit { value: string onChange?: (value: string) => void onRelease?: (value: string) => void + inputRef?: React.Ref } -const StringInput = ({ value, onChange, onRelease, className, ...rest }: StringInputProps) => { +const StringInput = ({ value, onChange, onRelease, className, inputRef, ...rest }: StringInputProps) => { return ( { onRelease?.(e.target.value) }} + ref={inputRef} {...rest} /> ) diff --git a/packages/ui/src/components/editor/panels/Properties/elementList/index.tsx b/packages/ui/src/components/editor/panels/Properties/elementList/index.tsx index 9cbb57c3c7..5fcf4d1377 100644 --- a/packages/ui/src/components/editor/panels/Properties/elementList/index.tsx +++ b/packages/ui/src/components/editor/panels/Properties/elementList/index.tsx @@ -24,7 +24,7 @@ Ethereal Engine. All Rights Reserved. */ import { startCase } from 'lodash' -import React, { useRef } from 'react' +import React, { useEffect, useRef } from 'react' import { useTranslation } from 'react-i18next' import { Component } from '@etherealengine/ecs/src/ComponentFunctions' @@ -129,6 +129,11 @@ export function ElementList() { const searchTimeout = useRef | null>(null) const shelves = useComponentShelfCategories(search.query.value) + const inputReference = useRef(null) + + useEffect(() => { + inputReference.current?.focus() + }, []) const onSearch = (text: string) => { search.local.set(text) @@ -147,6 +152,7 @@ export function ElementList() { placeholder={t('editor:layout.assetGrid.components-search')} value={search.local.value} onChange={(val) => onSearch(val)} + inputRef={inputReference} />