mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
fix context menu stuck on rating hover (#1079)
This commit is contained in:
@@ -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) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user