fix(desktop): scope dark styles and restore dialog blur

This commit is contained in:
t8y2 committed 2026-07-30 08:49:12 +08:00
1 parent 3143683b5a
commit e78a510485
6 files changed
+55 -8

No files matched your search

@@ -0,0 +1,24 @@
const DIALOG_BACKDROP_CLASS = "dbx-dialog-backdrop-active";
let dialogBackdropObserver: MutationObserver | undefined;
function hasDialogOverlay(): boolean {
return Array.from(document.body.children).some((child) => child.matches('[data-slot="dialog-overlay"]') || child.querySelector('[data-slot="dialog-overlay"]'));
}
function syncDialogBackdrop() {
document.documentElement.classList.toggle(DIALOG_BACKDROP_CLASS, hasDialogOverlay());
}
export function startDialogBackdropSync() {
if (typeof document === "undefined" || dialogBackdropObserver) return;
dialogBackdropObserver = new MutationObserver(syncDialogBackdrop);
dialogBackdropObserver.observe(document.body, { childList: true });
syncDialogBackdrop();
}
export function stopDialogBackdropSync() {
dialogBackdropObserver?.disconnect();
dialogBackdropObserver = undefined;
document.documentElement.classList.remove(DIALOG_BACKDROP_CLASS);
}