fix(UI): Improve model selection popup keyboard navigation and selection
- Add dynamic selected keys for the model selection menu - Ensure correct model is highlighted when pre-selected or navigated via keyboard - Simplify selection logic in SelectModelPopup component
This commit is contained in:
parent
602a6a5f66
commit
4a06c86412
@ -276,6 +276,8 @@ const PopupContainer: React.FC<PopupContainerProps> = ({ model, resolve }) => {
|
|||||||
setKeyboardSelectedId('')
|
setKeyboardSelectedId('')
|
||||||
}, [searchText])
|
}, [searchText])
|
||||||
|
|
||||||
|
const selectedKeys = keyboardSelectedId ? [keyboardSelectedId] : model ? [getModelUniqId(model)] : []
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
centered
|
centered
|
||||||
@ -322,7 +324,7 @@ const PopupContainer: React.FC<PopupContainerProps> = ({ model, resolve }) => {
|
|||||||
<Scrollbar style={{ height: '50vh' }} ref={scrollContainerRef}>
|
<Scrollbar style={{ height: '50vh' }} ref={scrollContainerRef}>
|
||||||
<Container>
|
<Container>
|
||||||
{filteredItems.length > 0 ? (
|
{filteredItems.length > 0 ? (
|
||||||
<StyledMenu items={filteredItems} selectedKeys={[keyboardSelectedId]} mode="inline" inlineIndent={6} />
|
<StyledMenu items={filteredItems} selectedKeys={selectedKeys} mode="inline" inlineIndent={6} />
|
||||||
) : (
|
) : (
|
||||||
<EmptyState>
|
<EmptyState>
|
||||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user