mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
fix context menu stuck on rating hover (#1079)
This commit is contained in:
parent
878e0007d9
commit
54932fee86
1 changed files with 9 additions and 7 deletions
|
|
@ -105,7 +105,14 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
|
||||||
const disabledItems = useSettingsStore((state) => state.general.disabledContextMenu);
|
const disabledItems = useSettingsStore((state) => state.general.disabledContextMenu);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [opened, setOpened] = useState(false);
|
const [opened, setOpened] = useState(false);
|
||||||
const clickOutsideRef = useClickOutside(() => setOpened(false));
|
|
||||||
|
const [ratingsRef, setRatingsRef] = useState<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
const clickOutsideRef = useClickOutside(
|
||||||
|
() => setOpened(false),
|
||||||
|
['mousedown', 'touchstart'],
|
||||||
|
[ratingsRef],
|
||||||
|
);
|
||||||
|
|
||||||
const viewport = useViewportSize();
|
const viewport = useViewportSize();
|
||||||
const server = useCurrentServer();
|
const server = useCurrentServer();
|
||||||
|
|
@ -950,12 +957,7 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
|
||||||
</ContextMenuButton>
|
</ContextMenuButton>
|
||||||
</HoverCard.Target>
|
</HoverCard.Target>
|
||||||
<HoverCard.Dropdown>
|
<HoverCard.Dropdown>
|
||||||
<Stack
|
<Stack gap={0} ref={setRatingsRef}>
|
||||||
gap={0}
|
|
||||||
// Pass in this ref to the stack component as well
|
|
||||||
// so that it is treated as "inside" for clickOutsideRef
|
|
||||||
ref={mergedRef}
|
|
||||||
>
|
|
||||||
{contextMenuItems[
|
{contextMenuItems[
|
||||||
item.id
|
item.id
|
||||||
].children?.map((child) => (
|
].children?.map((child) => (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue