Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Dialog): content not expanding dialog properly #2183

Merged
merged 3 commits into from
Feb 3, 2025
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
5 changes: 5 additions & 0 deletions .changeset/tender-days-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@frontify/fondue-components": patch
---

fix(`Dialog`): dialog content not expanding to max width value
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,26 @@ test('should not render borders when showBorder is false', async ({ mount, page
await expect(headerElement).not.toHaveCSS('border-bottom-width', '1px');
await expect(footerElement).not.toHaveCSS('border-top-width', '1px');
});

test('should have its content to expand to max width set by user', async ({ mount, page }) => {
await mount(
<Dialog.Root open>
<Dialog.Trigger>
<Button>{DIALOG_TRIGGER_TEXT}</Button>
</Dialog.Trigger>

<Dialog.Content maxWidth="810px">
<Dialog.Header showBorder={false} data-test-id={DIALOG_HEADER_TEST_ID}>
<Dialog.Title>{DIALOG_HEADER_TEXT}</Dialog.Title>
</Dialog.Header>
<Dialog.Body data-test-id={DIALOG_BODY_TEST_ID}>
<div style={{ width: '1234px' }}>Content</div>
</Dialog.Body>
</Dialog.Content>
</Dialog.Root>,
);

const contentElement = page.getByTestId(DIALOG_CONTENT_TEST_ID);
await expect(contentElement).toHaveCSS('max-width', '810px');
await expect(contentElement).toHaveCSS('width', '810px');
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@include mediaQuery.sm {
left: 50%;
transform: translateX(-50%) translateY(-50%);
width: fit-content;
width: max-content;
min-width: var(--dialog-min-width);
grid-template-rows: auto minmax(0, 1fr) auto;
grid-template-columns: min-content auto;
Expand Down