Skip to content

Commit

Permalink
fix: prevent incorrect overflow in Safari (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Jul 22, 2020
1 parent 5ec3e11 commit f2c0ac5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vaadin-dialog-resizable-mixin.html
Expand Up @@ -19,7 +19,7 @@
}

[part='overlay'][style] .resizer-container {
height: 100%;
min-height: 100%;
width: 100%;
}

Expand Down
29 changes: 29 additions & 0 deletions test/vaadin-dialog_draggable-resizable-test.html
Expand Up @@ -79,6 +79,15 @@
</template>
</test-fixture>

<test-fixture id="overflow">
<template>
<vaadin-dialog draggable opened modeless>
<template>
</template>
</vaadin-dialog>
</template>
</test-fixture>

<script>
function dispatchMouseEvent(target, type, coords = {x: 0, y: 0}, button = 0) {
const e = new MouseEvent(type, {
Expand Down Expand Up @@ -728,5 +737,25 @@
expect(modalDialog.opened).to.be.true;
});
});

describe('dialog with overflowing content', () => {
let dialog;

beforeEach(() => {
dialog = fixture('overflow');
});

it('should not overflow when style attribute is set on the overlay part', () => {
const container = document.createElement('div');
container.style.maxWidth = '300px';
container.style.overflow = 'auto';
container.textContent = Array(100).join('Lorem ipsum dolor sit amet');
const overlay = dialog.$.overlay;
overlay.content.appendChild(container);
// emulate removing "pointer-events: none"
overlay.$.overlay.setAttribute('style', '');
expect(overlay.$.overlay.offsetHeight).to.equal(overlay.$.resizerContainer.offsetHeight);
});
});
</script>
</body>

0 comments on commit f2c0ac5

Please sign in to comment.