mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): blur tab on click
Fixes issue where after clicking a tab, using the arrow keys changes tab instead of changing selected image
This commit is contained in:
parent
68be95acbb
commit
93f3658a4a
@ -14,7 +14,7 @@ import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { setIsLightboxOpen } from 'features/lightbox/store/lightboxSlice';
|
||||
import { InvokeTabName } from 'features/ui/store/tabMap';
|
||||
import { setActiveTab, togglePanels } from 'features/ui/store/uiSlice';
|
||||
import { memo, ReactNode, useCallback, useMemo } from 'react';
|
||||
import { memo, MouseEvent, ReactNode, useCallback, useMemo } from 'react';
|
||||
import { useHotkeys } from 'react-hotkeys-hook';
|
||||
import { MdDeviceHub, MdGridOn } from 'react-icons/md';
|
||||
import { GoTextSize } from 'react-icons/go';
|
||||
@ -47,22 +47,22 @@ export interface InvokeTabInfo {
|
||||
const tabs: InvokeTabInfo[] = [
|
||||
{
|
||||
id: 'txt2img',
|
||||
icon: <Icon as={GoTextSize} sx={{ boxSize: 6 }} />,
|
||||
icon: <Icon as={GoTextSize} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
|
||||
content: <TextToImageTab />,
|
||||
},
|
||||
{
|
||||
id: 'img2img',
|
||||
icon: <Icon as={FaImage} sx={{ boxSize: 6 }} />,
|
||||
icon: <Icon as={FaImage} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
|
||||
content: <ImageTab />,
|
||||
},
|
||||
{
|
||||
id: 'unifiedCanvas',
|
||||
icon: <Icon as={MdGridOn} sx={{ boxSize: 6 }} />,
|
||||
icon: <Icon as={MdGridOn} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
|
||||
content: <UnifiedCanvasTab />,
|
||||
},
|
||||
{
|
||||
id: 'nodes',
|
||||
icon: <Icon as={MdDeviceHub} sx={{ boxSize: 6 }} />,
|
||||
icon: <Icon as={MdDeviceHub} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
|
||||
content: <NodesTab />,
|
||||
},
|
||||
];
|
||||
@ -119,6 +119,12 @@ const InvokeTabs = () => {
|
||||
}
|
||||
}, [dispatch, activeTabName]);
|
||||
|
||||
const handleClickTab = useCallback((e: MouseEvent<HTMLElement>) => {
|
||||
if (e.target instanceof HTMLElement) {
|
||||
e.target.blur();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const tabs = useMemo(
|
||||
() =>
|
||||
enabledTabs.map((tab) => (
|
||||
@ -128,7 +134,7 @@ const InvokeTabs = () => {
|
||||
label={String(t(`common.${tab.id}` as ResourceKey))}
|
||||
placement="end"
|
||||
>
|
||||
<Tab>
|
||||
<Tab onClick={handleClickTab}>
|
||||
<VisuallyHidden>
|
||||
{String(t(`common.${tab.id}` as ResourceKey))}
|
||||
</VisuallyHidden>
|
||||
@ -136,7 +142,7 @@ const InvokeTabs = () => {
|
||||
</Tab>
|
||||
</Tooltip>
|
||||
)),
|
||||
[t, enabledTabs]
|
||||
[enabledTabs, t, handleClickTab]
|
||||
);
|
||||
|
||||
const tabPanels = useMemo(
|
||||
|
Loading…
Reference in New Issue
Block a user