mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
fix clickoutside on main context menu
This commit is contained in:
parent
cbbf2db087
commit
53499e2579
1 changed files with 3 additions and 2 deletions
|
|
@ -101,6 +101,7 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [opened, setOpened] = useState(false);
|
const [opened, setOpened] = useState(false);
|
||||||
|
|
||||||
|
const [contextMenuRef, setContextMenuRef] = useState<HTMLDivElement | null>(null);
|
||||||
const [ratingsRef, setRatingsRef] = useState<HTMLDivElement | null>(null);
|
const [ratingsRef, setRatingsRef] = useState<HTMLDivElement | null>(null);
|
||||||
const [rating, setRating] = useState<number>(0);
|
const [rating, setRating] = useState<number>(0);
|
||||||
|
|
||||||
|
|
@ -111,7 +112,7 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
|
||||||
const clickOutsideRef = useClickOutside(
|
const clickOutsideRef = useClickOutside(
|
||||||
() => setOpened(false),
|
() => setOpened(false),
|
||||||
['mousedown', 'touchstart'],
|
['mousedown', 'touchstart'],
|
||||||
[ratingsRef],
|
[contextMenuRef, ratingsRef],
|
||||||
);
|
);
|
||||||
|
|
||||||
const viewport = useViewportSize();
|
const viewport = useViewportSize();
|
||||||
|
|
@ -908,7 +909,7 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{opened && (
|
{opened && (
|
||||||
<ContextMenu minWidth={125} ref={mergedRef} xPos={ctx.xPos} yPos={ctx.yPos}>
|
<ContextMenu minWidth={125} ref={mergedRef} xPos={ctx.xPos} yPos={ctx.yPos}>
|
||||||
<Stack gap={0}>
|
<Stack gap={0} ref={setContextMenuRef}>
|
||||||
<Stack gap={0} onClick={closeContextMenu}>
|
<Stack gap={0} onClick={closeContextMenu}>
|
||||||
{ctx.menuItems?.map((item) => {
|
{ctx.menuItems?.map((item) => {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue