Autofocus shelf owner search if empty

This commit is contained in:
Tanner Collin 2023-05-30 14:36:08 -06:00
parent 45b0dd6ffe
commit 3d6666cc40
2 changed files with 5 additions and 1 deletions

View File

@ -25,7 +25,7 @@ const memberSorts = {
};
export function MembersDropdown(props) {
const { token, name, onChange, value, initial } = props;
const { token, name, onChange, value, initial, autofocus } = props;
const [response, setResponse] = useState({ results: [] });
const searchDefault = {seq: 0, q: initial || '', sort: 'newest_active'};
const [search, setSearch] = useState(searchDefault);
@ -61,6 +61,9 @@ export function MembersDropdown(props) {
placeholder='Search for Member'
onChange={onChange}
onSearchChange={(e, v) => setSearch({seq: parseInt(e.timeStamp), q: v.searchQuery, sort: 'newest_active'})}
searchInput={{ autoFocus: autofocus }}
openOnFocus={!autofocus}
/>
);

View File

@ -33,6 +33,7 @@ export function StorageEditor(props) {
{...makeProps('member_id')}
onChange={handleValues}
initial={input.member_name}
autofocus={!input.member_name}
/>
</Form.Field>