8000 safari menu button fix by JulianWielga · Pull Request #8069 · TouK/nussknacker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

safari menu button fix #8069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { PropsOf } from "@emotion/react";
import { ArrowDropDown } from "@mui/icons-material";
import { Menu, MenuItem, styled } from "@mui/material";
import type { PopoverPosition } from "@mui/material/Popover/Popover";
import React, { useContext } from "react";

import type { Option } from "../../graph/node-modal/fragment-input-definition/TypeSelect";
Expand Down Expand Up @@ -30,7 +31,7 @@ const ExpandButton = styled(Button)(({ theme }) => {
});

export const ButtonMenu = function ButtonMenu({ options = [], selected, onChange, className, buttonProps }: ToolbarButtonMenuWrapperProps) {
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
const [anchorPosition, setAnchorPosition] = React.useState<null | PopoverPosition>(null);
const { variant } = useContext(ToolbarButtonsContext);

if (options.length < 1) {
Expand Down Expand Up @@ -76,17 +77,18 @@ export const ButtonMenu = function ButtonMenu({ options = [], selected, onChange
disabled={buttonProps.disabled}
=> {
e.stopPropagation();
setAnchorEl(e.currentTarget);
setAnchorPosition({ top: e.clientY, left: e.clientX });
}}
>
<ArrowDropDown />
</ExpandButton>
<Menu
anchorEl={anchorEl}
open={Boolean(anchorEl)}
anchorReference="anchorPosition"
anchorPosition={anchorPosition}
open={Boolean(anchorPosition)}
Event) => {
e.stopPropagation();
setAnchorEl(null);
setAnchorPosition(null);
}}
>
{options.map((option) => (
Expand All @@ -97,7 +99,7 @@ export const ButtonMenu = function ButtonMenu({ options = [], selected, onChange
=> {
e.stopPropagation();
onChange(option);
setAnchorEl(null);
setAnchorPosition(null);
}}
>
{option.label}
Expand Down
Loading
0