chore: fix modal positioning when using themed desktop titlebar

This commit is contained in:
Aman Harwara
2023-07-05 20:43:55 +05:30
parent d4db3e055c
commit 2611c88cee
2 changed files with 3 additions and 1 deletions

View File

@@ -128,7 +128,7 @@ async function configureWindow(remoteBridge: CrossProcessBridge) {
/* Use custom title bar. Take the sn-titlebar-height off of
the app content height so its not overflowing */
sheet.insertRule(
'[role="dialog"] { position: relative; height: calc(100vh - var(--sn-desktop-titlebar-height)) !important; margin-top: var(--sn-desktop-titlebar-height) !important; }',
'[role="dialog"] { height: calc(100vh - var(--sn-desktop-titlebar-height)) !important; top: var(--sn-desktop-titlebar-height); }',
sheet.cssRules.length,
)
sheet.insertRule(

View File

@@ -27,11 +27,13 @@ export const usePopoverCloseOnClickOutside = ({
const isDescendantOfChildPopover = closestPopoverId && childPopovers.has(closestPopoverId)
const isPopoverInModal = popoverElement?.closest('[data-dialog], .sk-modal')
const isDescendantOfModal = isPopoverInModal ? false : !!target.closest('[data-dialog], .sk-modal')
const isDescendantOfDesktopTitlebar = !!target.closest('#desktop-title-bar')
if (
!isDescendantOfMenu &&
!isAnchorElement &&
!isDescendantOfChildPopover &&
!isDescendantOfDesktopTitlebar &&
(!isDescendantOfModal || (isDescendantOfModal && hideOnClickInModal))
) {
if (!disabled) {