mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
fix(ui): focus add node popover on open
Need an extra ref to pass to the InvSelect component.
This commit is contained in:
committed by
Kent Keirsey
parent
5168415999
commit
6209fef63d
@@ -4,7 +4,7 @@ import type {
|
||||
StylesConfig,
|
||||
} from 'chakra-react-select';
|
||||
import { Select as ChakraReactSelect } from 'chakra-react-select';
|
||||
import { memo, useMemo } from 'react';
|
||||
import { memo, useEffect, useMemo } from 'react';
|
||||
|
||||
import { CustomMenuList } from './CustomMenuList';
|
||||
import { CustomOption } from './CustomOption';
|
||||
@@ -29,7 +29,7 @@ const components: SelectComponentsConfig<
|
||||
};
|
||||
|
||||
export const InvSelect = memo((props: InvSelectProps) => {
|
||||
const { sx, selectRef, ...rest } = props;
|
||||
const { sx, selectRef, inputRef, ...rest } = props;
|
||||
const chakraStyles = useMemo<CustomChakraStylesConfig>(
|
||||
() => ({
|
||||
container: (provided, _state) => ({ ...provided, w: 'full', ...sx }),
|
||||
@@ -55,6 +55,13 @@ export const InvSelect = memo((props: InvSelectProps) => {
|
||||
[sx]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!inputRef) {
|
||||
return;
|
||||
}
|
||||
inputRef.current = selectRef?.current?.inputRef ?? null;
|
||||
}, [inputRef, selectRef]);
|
||||
|
||||
return (
|
||||
<ChakraReactSelect<InvSelectOption, false, GroupBase<InvSelectOption>>
|
||||
ref={selectRef}
|
||||
|
||||
Reference in New Issue
Block a user