fix(desktop): tooltips no longer open under the macOS traffic lights (#17726)
This commit is contained in:
1 parent
c1d528a342
commit
662148dd29
1 file changed
+7
-1
@@ -1,10 +1,15 @@
|
||||
import { useSyncExternalStore } from "react";
|
||||
|
||||
import { isWindowsPlatform } from "./utils";
|
||||
import { isElectron } from "~/env";
|
||||
|
||||
import { isMacPlatform, isWindowsPlatform } from "./utils";
|
||||
|
||||
const WCO_CLASS_NAME = "wco";
|
||||
const ELECTRON_CLASS_NAME = "electron";
|
||||
const ELECTRON_WINDOWS_CLASS_NAME = "electron-windows";
|
||||
// The workspace topbar the desktop app centers the traffic lights in. macOS has
|
||||
// no overlay API to measure, and the lights stay inside it at any zoom level.
|
||||
const MACOS_TITLEBAR_HEIGHT = 52;
|
||||
|
||||
interface WindowControlsOverlayLike {
|
||||
readonly visible: boolean;
|
||||
@@ -53,6 +58,7 @@ function subscribeTitlebarArea(listener: () => void): () => void {
|
||||
}
|
||||
|
||||
function getNativeTitlebarHeight(): number {
|
||||
if (isElectron && isMacPlatform(navigator.platform)) return MACOS_TITLEBAR_HEIGHT;
|
||||
const overlay = getWindowControlsOverlay();
|
||||
return overlay?.visible ? overlay.getTitlebarAreaRect().bottom : 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user