Skip to content

Commit b39074c

Browse files
vaadin-botugur-vaadinweb-padawan
authored
fix: prevent dialog from shrinking on the right edge (#10400) (#10401)
Co-authored-by: Ugur Saglam <106508695+ugur-vaadin@users.noreply.github.com> Co-authored-by: web-padawan <iamkulykov@gmail.com>
1 parent 59caf18 commit b39074c

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

packages/dialog/src/vaadin-dialog-styles.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export const resizableOverlay = css`
9191
overflow: visible;
9292
max-height: 100%;
9393
display: flex;
94+
width: max-content;
9495
}
9596
9697
[part='content'] {

packages/dialog/test/draggable-resizable.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,20 @@ describe('draggable', () => {
584584
expect(Math.floor(draggedBounds.height)).to.be.eql(Math.floor(bounds.height));
585585
});
586586

587+
it('should not shrink dialog when dragged to the right edge', async () => {
588+
dialog.renderer = (root) => {
589+
root.innerHTML = `<div style="padding: 20px;">Lorem ipsum dolor sit amet</div>`;
590+
};
591+
await nextRender();
592+
const initialWidth = container.offsetWidth;
593+
const bounds = container.getBoundingClientRect();
594+
const targetX = window.innerWidth - 100;
595+
dx = targetX - Math.floor(bounds.left + bounds.width / 2);
596+
drag(container);
597+
await nextRender();
598+
expect(container.offsetWidth).to.equal(initialWidth);
599+
});
600+
587601
it('should not reset scroll position on dragstart', async () => {
588602
dialog.modeless = true;
589603
button.style.marginBottom = '200px';

packages/dialog/test/visual/material/dialog.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ describe('dialog', () => {
6060
});
6161

6262
it('long title and header renderer', async () => {
63-
element.$.overlay.style.maxWidth = '20rem';
63+
// Override default Material max-width: 560px
64+
element.$.overlay.$.overlay.style.maxWidth = '20rem';
6465
element.headerTitle = 'Long title that wraps in multiple lines';
6566
element.headerRenderer = createRenderer('Header');
6667
await nextUpdate(element);
6768
await visualDiff(div, 'header-title-multiple-lines');
6869
});
6970

7071
it('long single word title and header renderer', async () => {
71-
element.$.overlay.style.maxWidth = '20rem';
72+
// Override default Material max-width: 560px
73+
element.$.overlay.$.overlay.style.maxWidth = '20rem';
7274
element.headerTitle = 'InternationalizationConfigurationHelper';
7375
element.headerRenderer = createRenderer('Header');
7476
await nextUpdate(element);

0 commit comments

Comments
 (0)