Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions browser_tests/fixtures/utils/workspaceInset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { Locator, Page } from '@playwright/test'

import { WORKSPACE_INSET_RIGHT } from '@/composables/useWorkspaceInset'
import { comfyExpect } from '@e2e/fixtures/utils/customMatchers'

export async function expectDialogBoundsWithDockedPanel(
page: Page,
dialog: Locator,
{ panelWidth, x }: { panelWidth: number; x: number }
): Promise<void> {
await comfyExpect
.poll(() => dialog.evaluate((element) => element.getAnimations().length))
.toBe(0)
const withoutPanel = await dialog.boundingBox()
if (!withoutPanel) throw new Error('Dialog is not laid out')

await page.evaluate(
({ property, panelWidth }) => {
document.documentElement.style.setProperty(property, `${panelWidth}px`)
},
{ property: WORKSPACE_INSET_RIGHT, panelWidth }
)

await comfyExpect(dialog).toHaveBounds(
{ ...withoutPanel, x },
{ numDigits: 1 }
)
}
54 changes: 54 additions & 0 deletions browser_tests/tests/dialogs/dialogAgentPanelInset.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import {
comfyExpect as expect,
comfyPageFixture as test
} from '@e2e/fixtures/ComfyPage'
import { expectDialogBoundsWithDockedPanel } from '@e2e/fixtures/utils/workspaceInset'

test.describe('Dialog layout with a docked Agent panel', () => {
for (const { viewportWidth, x, outcome } of [
{ viewportWidth: 1440, x: 8, outcome: 'covers the panel from the gutter' },
{ viewportWidth: 1920, x: 50, outcome: 'centres beside the panel' }
]) {
test.describe(`at a ${viewportWidth}px viewport`, () => {
test.use({ viewport: { width: viewportWidth, height: 800 } })

test(`Templates browser keeps its size and ${outcome}`, async ({
comfyPage
}) => {
await comfyPage.command.executeCommand('Comfy.BrowseTemplates')
await expect(comfyPage.templates.content).toBeVisible()

await expectDialogBoundsWithDockedPanel(
comfyPage.page,
comfyPage.templatesDialog.root,
{ panelWidth: 420, x }
)
})
})
}

test.describe('at the sm breakpoint', () => {
test.use({ viewport: { width: 640, height: 800 } })

test('a size-variant dialog keeps its width and stops at the gutter', async ({
comfyPage
}) => {
await comfyPage.page.evaluate(() => {
window
.app!.extensionManager.dialog.confirm({
title: 'Confirm',
type: 'default',
message: 'Does this dialog keep its width?'
})
.catch(() => {})
})
await expect(comfyPage.confirmDialog.root).toBeVisible()

await expectDialogBoundsWithDockedPanel(
comfyPage.page,
comfyPage.confirmDialog.root,
{ panelWidth: 420, x: 8 }
)
})
})
})
17 changes: 11 additions & 6 deletions src/components/ui/dialog/dialog.variants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ export const dialogContentVariants = cva({
base: 'fixed z-1700 flex flex-col rounded-lg border border-border-subtle bg-base-background shadow-lg outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
variants: {
size: {
sm: 'sm:max-w-[min(24rem,calc(100vw-var(--workspace-inset-right,0px)-1rem))]',
md: 'sm:max-w-[min(36rem,calc(100vw-var(--workspace-inset-right,0px)-1rem))]',
lg: 'sm:max-w-[min(48rem,calc(100vw-var(--workspace-inset-right,0px)-1rem))]',
xl: 'sm:max-w-[min(64rem,calc(100vw-var(--workspace-inset-right,0px)-1rem))]',
full: 'sm:max-w-[calc(100vw-var(--workspace-inset-right,0px)-1rem)]'
sm: 'sm:max-w-96',
md: 'sm:max-w-xl',
lg: 'sm:max-w-3xl',
xl: 'sm:max-w-5xl',
full: 'sm:max-w-[calc(100vw-1rem)]'
Comment thread
christian-byrne marked this conversation as resolved.
Resolved
},
maximized: {
true: 'inset-2 top-2 left-2 size-auto max-h-none max-w-none sm:max-w-none',
false:
'top-1/2 left-[calc(50%-var(--workspace-inset-right,0px)/2)] max-h-[85vh] w-[calc(100vw-1rem)] -translate-1/2'
'top-1/2 left-1/2 max-h-[85vh] w-[calc(100vw-1rem)] translate-x-[max(calc(min(0.5rem,100vw-100%)-50vw),calc(-50%-var(--workspace-inset-right,0px)/2))] -translate-y-1/2'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium — Moving the panel offset out of left and into translate-x makes the left-1/2 opt-out that four shipped dialogs pass via contentClass inert (src/services/hdrViewerService.ts, src/components/sidebar/tabs/AssetsSidebarTab.vue, src/components/sidebar/tabs/JobHistorySidebarTab.vue, src/workbench/extensions/agent/components/agent/message/ReplyAssetGroup.vue): those classes used to beat the inset-shifted left, but they cannot override this translate-x, so those w-[80vw] media viewers move from the true viewport centre to the clamped gutter (x=192 to x=8 with a 420px panel at 1920px). Either preserve their centring explicitly or delete the now-dead left-1/2 overrides so the next editor isn't misled. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max adversarial, claude-opus-5-thinking-max edge-case).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed. These four left-1/2 classes were introduced together in #16198 specifically as overrides of the inset-shifted base left; moving the offset to translate-x makes all four overrides dead and changes their docked-panel geometry. This is a source-level issue in merged #20002, not a core/1.55 target conflict. The carrier job authorizes only target-specific repair, so I am leaving this thread unresolved and holding the backport. Wake condition: a source fix/decision lands on main and is carried here, or the owning human explicitly rules that these media viewers should adopt the shifted/clamped policy and removes the misleading overrides.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Measured, and the diagnosis needs correcting: this is not a source-level issue in #20002. Those four left-1/2 overrides do not exist on main.

#19729 (merged 2026-10-02, two days before #20002) deleted all four of them and routed every viewer entry point — HDR, Assets, Job History, Agent reply, the node, and viewer controls — through one shared LOAD3D_VIEWER_DIALOG_PROPS whose contentClass is inset-aware in both the unprefixed and sm:-prefixed max-w groups. That cap is exactly 100vw - inset - 1rem, which keeps the viewer on the centring branch of the new clamp. Measured against the real 420px docked panel at main 94ddfcc78d:

viewport viewer x viewer right panel left
1280 8 852 860
1440 8 1012 1020
1920 8 1492 1500

It clears the panel at every width. There is nothing dead and nothing to repair at source.

The regression is real, but it is release-line-only, and it is caused by #19729 being absent there rather than by anything #20002 did. core/1.55, cloud/1.55, core/1.54 and cloud/1.54 all still carry the pre-#19729 contentClass (left-1/2 w-[80vw] sm:max-w-[80vw] …), because #19729 has no backport. Measured by restoring that string on top of each dialog variant:

file state viewer x width viewer right panel left @1920
release branches, pre-#20002 192 1536 1728 1500
release branches + #20002 clamp 8 1536 1544 1500
main (#19729 + #20002) 8 1484 1492 1500

So the "x=192 → x=8" figure is right, and the override is genuinely inert in row 2 — but row 1 was already overlapping the panel by 228px. The 192px position was never correct docked behaviour; #19729 is what made it correct, and #20002 reduced the overlap from 228px to 44px rather than introducing it.

That makes this an already-merged bug-fix dependency of the carrier, so the unblock is to carry #19729 to the release lines, not to patch #20125 or change main. Two notes on urgency: cloud/1.55 already took #20002 via #20126, so it carries the 44px overlap today, independent of this PR; and core/1.55 has it at 228px right now, so merging #20125 improves that line rather than regressing it.

I have not touched the release branches — this comment is measurement only.

Separately, the gap that let this reach review is now closed at source: #20136 pins the viewer's docked-panel geometry at 1280px and 1920px. The guard in load3dAgentUpdate.spec.ts only ran at 500px and 400px, both under sm:, so it could not observe the sm:-prefixed cap at all — deleting only that declaration leaves the spec green on the parent while the viewer covers the panel by 180px at 1280px.

Comment thread
christian-byrne marked this conversation as resolved.
Resolved
Comment thread
christian-byrne marked this conversation as resolved.
Resolved
}
},
defaultVariants: {
Expand All @@ -36,3 +36,8 @@ const sizes = [
] as const satisfies Array<DialogContentSize>

export const FOR_STORIES = { sizes } as const

export const HUG_CONTENT_CLASS =
'w-fit max-w-[calc(100vw-1rem)] sm:max-w-[calc(100vw-1rem)]'

export const SELF_STYLED_PANEL_CONTENT_CLASS = `${HUG_CONTENT_CLASS} border-none bg-transparent shadow-none`
4 changes: 2 additions & 2 deletions src/platform/assets/composables/useAssetBrowserDialog.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SELF_STYLED_PANEL_CONTENT_CLASS } from '@/components/ui/dialog/dialog.variants'
import AssetBrowserModal from '@/platform/assets/components/AssetBrowserModal.vue'
import type { AssetItem } from '@/platform/assets/schemas/assetSchema'
import { useDialogService } from '@/services/dialogService'
Expand Down Expand Up @@ -25,8 +26,7 @@ interface BrowseOptions {

const DIALOG_KEY = 'global-asset-browser'
const ASSET_BROWSER_DIALOG_PROPS = {
contentClass:
'w-fit max-w-[calc(100vw-var(--workspace-inset-right,0px)-1rem)] sm:max-w-[calc(100vw-var(--workspace-inset-right,0px)-1rem)] border-none bg-transparent shadow-none'
contentClass: SELF_STYLED_PANEL_CONTENT_CLASS
} satisfies DialogComponentProps

export const useAssetBrowserDialog = () => {
Expand Down
3 changes: 1 addition & 2 deletions src/platform/workflow/sharing/composables/useShareDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ export function useShareDialog() {
onClose: hide
},
dialogComponentProps: {
contentClass:
'sm:max-w-[min(36rem,calc(100vw-var(--workspace-inset-right,0px)-1rem))] rounded-2xl overflow-hidden'
contentClass: 'rounded-2xl overflow-hidden'
}
})
}
Expand Down
25 changes: 6 additions & 19 deletions src/services/dialogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import ConfirmationDialogContent from '@/components/dialog/content/ConfirmationD
import ErrorDialogContent from '@/components/dialog/content/ErrorDialogContent.vue'
import PromptDialogContent from '@/components/dialog/content/PromptDialogContent.vue'
import TopUpCreditsDialogContentLegacy from '@/components/dialog/content/TopUpCreditsDialogContentLegacy.vue'
import {
HUG_CONTENT_CLASS,
SELF_STYLED_PANEL_CONTENT_CLASS
} from '@/components/ui/dialog/dialog.variants'
import InsufficientCreditsMemberDialog from '@/platform/workspace/components/InsufficientCreditsMemberDialog.vue'
import TopUpCreditsDialogContentWorkspace from '@/platform/workspace/components/TopUpCreditsDialogContentWorkspace.vue'
import { useBillingCapabilities } from '@/platform/workspace/composables/useBillingCapabilities'
Expand Down Expand Up @@ -46,20 +50,6 @@ const lazyCloudNotificationContent = () =>
const lazyPublishDialog = () =>
import('@/platform/workflow/sharing/components/publish/ComfyHubPublishDialog.vue')

/**
* Shrink-wrap the Reka DialogContent around the content's intrinsic width,
* like the auto-sized PrimeVue root it replaces.
*/
const HUG_CONTENT_CLASS =
'w-fit max-w-[calc(100vw-1rem)] sm:max-w-[calc(100vw-1rem)]'

/**
* Reka chrome for headless dialogs whose content draws its own panel
* (background/border/rounding) — neutralize the DialogContent box and
* shrink-wrap it around the content.
*/
const SELF_STYLED_PANEL_CONTENT_CLASS = `${HUG_CONTENT_CLASS} border-none bg-transparent shadow-none`

// A type alias, not an interface: `showDialog`'s props are index-signature
// typed, and only object literal types get an implicit index signature.
type TopUpCreditsDialogOptions = {
Expand Down Expand Up @@ -613,10 +603,7 @@ export const useDialogService = () => {
dialogComponentProps: {
renderer: 'reka',
closable: true,
// Contents bring their own width and separators — shrink-wrap the
// chrome and zero the section padding.
contentClass:
'w-fit max-w-[calc(100vw-var(--workspace-inset-right,0px)-1rem)] sm:max-w-[calc(100vw-var(--workspace-inset-right,0px)-1rem)] border-border-default',
contentClass: `${HUG_CONTENT_CLASS} border-border-default`,
headerClass: 'p-0',
bodyClass: 'p-0 overflow-y-hidden',
footerClass: 'p-0',
Expand Down Expand Up @@ -982,7 +969,7 @@ export const useDialogService = () => {
dialogComponentProps: {
closable: false,
contentClass:
'w-170 max-w-[calc(100vw-var(--workspace-inset-right,0px)-1rem)] sm:max-w-[min(42.5rem,calc(100vw-var(--workspace-inset-right,0px)-1rem))] rounded-2xl overflow-hidden',
'w-170 max-w-[calc(100vw-1rem)] sm:max-w-[calc(100vw-1rem)] rounded-2xl overflow-hidden',
onRemoved: () => resolve()
}
})
Expand Down
Loading