From 4ce15577cd7cd6bd1f460f5f25856c380ead6767 Mon Sep 17 00:00:00 2001 From: GyDi <segydi@foxmail.com> Date: Sat, 19 Mar 2022 19:28:53 +0800 Subject: [PATCH] feat: prevent context menu on Windows close #22 --- src/pages/_layout.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/_layout.tsx b/src/pages/_layout.tsx index 43bad1c..e32a7c1 100644 --- a/src/pages/_layout.tsx +++ b/src/pages/_layout.tsx @@ -84,6 +84,10 @@ const Layout = () => { elevation={0} className={`${isWinOs ? "windows " : ""}layout`} onPointerDown={onDragging} + onContextMenu={(e) => { + // only prevent it on Windows + if (isWinOs) e.preventDefault(); + }} sx={[ (theme) => ({ bgcolor: alpha(theme.palette.background.paper, blur ? 0.85 : 1), -- GitLab