Skip to content

Commit cec252a

Browse files
committed
fix: force reflow on resize in Safari
1 parent 6ae8604 commit cec252a

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

bower.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"iron-component-page": "^3.0.0",
3838
"iron-test-helpers": "^2.0.0",
3939
"vaadin-button": "vaadin/vaadin-button#^2.4.0-alpha1",
40+
"vaadin-text-field": "vaadin/vaadin-text-field#~2.7.0-alpha6",
4041
"webcomponentsjs": "^1.0.0",
4142
"web-component-tester": "^6.1.5",
4243
"vaadin-demo-helpers": "vaadin/vaadin-demo-helpers#^3.1.0-alpha1"

src/vaadin-dialog.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,12 @@
401401
}
402402

403403
Object.assign(overlay.style, parsedBounds);
404+
405+
// Force reflow in Safari 13 to recalculate height
406+
overlay.style.display = 'block';
407+
window.requestAnimationFrame(() => {
408+
overlay.style.display = '';
409+
});
404410
}
405411

406412
/** @private */

test/vaadin-dialog_draggable-resizable-test.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<link rel="import" href="../../test-fixture/test-fixture.html">
88
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
99
<link rel="import" href="../src/vaadin-dialog.html">
10+
<link rel="import" href="../../vaadin-text-field/vaadin-text-area.html">
1011
</head>
1112

1213
<body>
@@ -756,6 +757,21 @@
756757
overlay.$.overlay.setAttribute('style', '');
757758
expect(overlay.$.overlay.offsetHeight).to.equal(overlay.$.resizerContainer.offsetHeight);
758759
});
760+
761+
it('should not overflow when using vaadin-textarea in the content', (done) => {
762+
const textarea = document.createElement('vaadin-text-area');
763+
textarea.value = Array(20).join('Lorem ipsum dolor sit amet');
764+
const overlay = dialog.$.overlay;
765+
overlay.content.appendChild(textarea);
766+
overlay.$.content.style.padding = '20px';
767+
// emulate resizing the dialog
768+
dialog._setBounds({height: 50});
769+
770+
window.requestAnimationFrame(() => {
771+
expect(getComputedStyle(overlay.$.overlay).height).to.equal(getComputedStyle(overlay.$.resizerContainer).height);
772+
done();
773+
});
774+
});
759775
});
760776
</script>
761777
</body>

0 commit comments

Comments
 (0)