mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-17 11:14:23 +01:00
fix: context menu getting covered (#10199)
* do not show z-index actions on mobile or tablet * fix: context menu getting covered * fix lint * fix style popup getting covered * put contextmenu z-index above sidebar --------- Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
@@ -11204,6 +11204,17 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
return [actionCopy, ...options];
|
return [actionCopy, ...options];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const zIndexActions: ContextMenuItems =
|
||||||
|
this.state.stylesPanelMode === "full"
|
||||||
|
? [
|
||||||
|
CONTEXT_MENU_SEPARATOR,
|
||||||
|
actionSendBackward,
|
||||||
|
actionBringForward,
|
||||||
|
actionSendToBack,
|
||||||
|
actionBringToFront,
|
||||||
|
]
|
||||||
|
: [];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
CONTEXT_MENU_SEPARATOR,
|
CONTEXT_MENU_SEPARATOR,
|
||||||
actionCut,
|
actionCut,
|
||||||
@@ -11229,11 +11240,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
actionUngroup,
|
actionUngroup,
|
||||||
CONTEXT_MENU_SEPARATOR,
|
CONTEXT_MENU_SEPARATOR,
|
||||||
actionAddToLibrary,
|
actionAddToLibrary,
|
||||||
CONTEXT_MENU_SEPARATOR,
|
...zIndexActions,
|
||||||
actionSendBackward,
|
|
||||||
actionBringForward,
|
|
||||||
actionSendToBack,
|
|
||||||
actionBringToFront,
|
|
||||||
CONTEXT_MENU_SEPARATOR,
|
CONTEXT_MENU_SEPARATOR,
|
||||||
actionFlipHorizontal,
|
actionFlipHorizontal,
|
||||||
actionFlipVertical,
|
actionFlipVertical,
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
@import "../css/variables.module.scss";
|
@import "../css/variables.module.scss";
|
||||||
|
|
||||||
.excalidraw {
|
.excalidraw {
|
||||||
|
.context-menu-popover {
|
||||||
|
z-index: var(--zIndex-ui-context-menu);
|
||||||
|
}
|
||||||
|
|
||||||
.context-menu {
|
.context-menu {
|
||||||
position: relative;
|
position: relative;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ export const ContextMenu = React.memo(
|
|||||||
offsetTop={appState.offsetTop}
|
offsetTop={appState.offsetTop}
|
||||||
viewportWidth={appState.width}
|
viewportWidth={appState.width}
|
||||||
viewportHeight={appState.height}
|
viewportHeight={appState.height}
|
||||||
|
className="context-menu-popover"
|
||||||
>
|
>
|
||||||
<ul
|
<ul
|
||||||
className="context-menu"
|
className="context-menu"
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { unstable_batchedUpdates } from "react-dom";
|
|||||||
|
|
||||||
import { KEYS, queryFocusableElements } from "@excalidraw/common";
|
import { KEYS, queryFocusableElements } from "@excalidraw/common";
|
||||||
|
|
||||||
|
import clsx from "clsx";
|
||||||
|
|
||||||
import "./Popover.scss";
|
import "./Popover.scss";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -15,6 +17,7 @@ type Props = {
|
|||||||
offsetTop?: number;
|
offsetTop?: number;
|
||||||
viewportWidth?: number;
|
viewportWidth?: number;
|
||||||
viewportHeight?: number;
|
viewportHeight?: number;
|
||||||
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Popover = ({
|
export const Popover = ({
|
||||||
@@ -27,6 +30,7 @@ export const Popover = ({
|
|||||||
offsetTop = 0,
|
offsetTop = 0,
|
||||||
viewportWidth = window.innerWidth,
|
viewportWidth = window.innerWidth,
|
||||||
viewportHeight = window.innerHeight,
|
viewportHeight = window.innerHeight,
|
||||||
|
className,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const popoverRef = useRef<HTMLDivElement>(null);
|
const popoverRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
@@ -146,7 +150,7 @@ export const Popover = ({
|
|||||||
}, [onCloseRequest]);
|
}, [onCloseRequest]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="popover" ref={popoverRef} tabIndex={-1}>
|
<div className={clsx("popover", className)} ref={popoverRef} tabIndex={-1}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,9 +12,10 @@
|
|||||||
--zIndex-eyeDropperPreview: 6;
|
--zIndex-eyeDropperPreview: 6;
|
||||||
--zIndex-hyperlinkContainer: 7;
|
--zIndex-hyperlinkContainer: 7;
|
||||||
|
|
||||||
--zIndex-ui-styles-popup: 40;
|
|
||||||
--zIndex-ui-bottom: 60;
|
--zIndex-ui-bottom: 60;
|
||||||
--zIndex-ui-library: 80;
|
--zIndex-ui-library: 80;
|
||||||
|
--zIndex-ui-context-menu: 90;
|
||||||
|
--zIndex-ui-styles-popup: 100;
|
||||||
--zIndex-ui-top: 100;
|
--zIndex-ui-top: 100;
|
||||||
|
|
||||||
--zIndex-modal: 1000;
|
--zIndex-modal: 1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user