Merge pull request #2970 from QuantumEntangledAndy/bug/modalPolyfilCenter

Center the crop popup on change, when polyfilled
This commit is contained in:
Cohee 2024-10-10 11:35:03 +03:00 committed by GitHub
commit 357c2e0756
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -182,6 +182,14 @@ export class Popup {
if (!this.dlg.showModal) {
this.dlg.classList.add('poly_dialog');
dialogPolyfill.registerDialog(this.dlg);
// Force a vertical reposition after the content
// (like crop image) has been set
const resizeObserver = new ResizeObserver((entries) => {
for (const entry of entries) {
dialogPolyfill.reposition(entry.target);
}
});
resizeObserver.observe(this.dlg);
}
this.body = this.dlg.querySelector('.popup-body');
this.content = this.dlg.querySelector('.popup-content');