Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(desktop): keep the titlebar draggable over the tab strip and while loading (#22462)

Innei226a6164e092
diff --git a/apps/desktop/index.html b/apps/desktop/index.html
index 1c5db837adc..7aebc2ce9b6 100644
--- a/apps/desktop/index.html
+++ b/apps/desktop/index.html
@@ -15,6 +15,15 @@
background: inherit;
gap: 12px;
}
+ /* The window is frameless, so the titlebar band is only draggable through CSS. This
+ screen is the whole window until React mounts, which left the titlebar dead for the
+ first paint. Height matches TITLE_BAR_HEIGHT in @lobechat/desktop-bridge. */
+ #loading-drag-bar {
+ position: fixed;
+ inset: 0 0 auto;
+ height: 38px;
+ -webkit-app-region: drag;
+ }
@keyframes loading-draw {
0% {
stroke-dashoffset: 1000;
@@ -89,6 +98,7 @@
})();
</script>
<div id="loading-screen">
+ <div id="loading-drag-bar"></div>
<div id="loading-brand" aria-label="Loading" role="status">
<svg
fill="currentColor"
diff --git a/apps/desktop/popup.html b/apps/desktop/popup.html
index 1f32c3dacb6..1f6ef683a9f 100644
--- a/apps/desktop/popup.html
+++ b/apps/desktop/popup.html
@@ -27,6 +27,15 @@
background: inherit;
gap: 12px;
}
+ /* The window is frameless, so the titlebar band is only draggable through CSS. This
+ screen is the whole window until React mounts, which left the titlebar dead for the
+ first paint. Height matches TITLE_BAR_HEIGHT in @lobechat/desktop-bridge. */
+ #loading-drag-bar {
+ position: fixed;
+ inset: 0 0 auto;
+ height: 38px;
+ -webkit-app-region: drag;
+ }
@keyframes loading-draw {
0% {
stroke-dashoffset: 1000;
@@ -89,6 +98,7 @@
})();
</script>
<div id="loading-screen">
+ <div id="loading-drag-bar"></div>
<div id="loading-brand" aria-label="Loading" role="status">
<svg
fill="currentColor"
diff --git a/src/styles/electron.ts b/src/styles/electron.ts
index c626f0b230a..e0a1108a295 100644
--- a/src/styles/electron.ts
+++ b/src/styles/electron.ts
@@ -1,3 +1,4 @@
+import { cx } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
const styles = stylex.create({
@@ -5,7 +6,17 @@ const styles = stylex.create({
nodrag: { WebkitAppRegion: 'no-drag' },
});
-export const draggable = stylex.props(styles.draggable).className ?? '';
+/**
+ * Hook class for the drag region, keyed by `global.css` to scope the `button` opt-out.
+ * StyleX cannot express a descendant selector, and the opt-out must not be page-wide:
+ * Chromium reports every app-region box's *unclipped* border box in layout order and the
+ * later rect wins, so a global `button { -webkit-app-region: no-drag }` turned every
+ * button in the page into a hole in the titlebar — including buttons in the content
+ * below that scroll up under it, which come after the titlebar in layout order.
+ */
+const DRAG_REGION_CLASS = 'lobe-drag-region';
+
+export const draggable = cx(stylex.props(styles.draggable).className, DRAG_REGION_CLASS);
export const nodrag = stylex.props(styles.nodrag).className ?? '';
diff --git a/src/styles/global.css b/src/styles/global.css
index 35533383aba..7188035084d 100644
--- a/src/styles/global.css
+++ b/src/styles/global.css
@@ -88,7 +88,11 @@ html.desktop[data-window-fullscreen] body {
background-color: var(--lobe-color-bg-layout);
}
-button {
+/* Drag-region hook class from @/styles/electron. Buttons opt out of the drag region only
+ inside one: Chromium applies every app-region box's unclipped border box in layout
+ order, later rect winning, so a page-wide button opt-out punched holes in the titlebar
+ from buttons in the content below that had scrolled up under it. */
+.lobe-drag-region button {
-webkit-app-region: no-drag;
}