So I have some Angular 7 code that makes extensive use of material dialogs, all works great when I view it as a webpage, but when I try to load it as a chrome extension, everything but the dialogs render correctly. When a dialog gets opened, the whole extension window gets a small width. I should note that the dialog does appear, everything just gets so small it isnt useable at all.
I have tried to replicate this behaviour when viewing the webpage in a small window, both with and without the responsive settings from chrome.
I think this might have something to do with permission, but I dont know what I should change. However I dont get any errors on the chrome://extension page, nor is anything logged to the console.
I have the following permissions and csp in my manifest.json
"permissions": [
"activeTab"
],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
How I use dialogs:
I inject MatDialog
into the constructor of a service, create a function for that service that calls open(DialogComponent, {width: '25em', height: '25em', disableClose: true})
on the injected MatDialog. (I get the settings from another service) and I return the afterClosed().toPromise()
.
The DialogComponent gets a MatDialogRef<DialogComponent>
injected in its contructor. Some of my dialogs call the dialogRef.close
with parameters, some dont use parameters.
I added a github reproduction repository: https://github.com/erikknaake/dialog-reproduction/tree/master/dialog-reproduction
I should mention this happens in the default_popup: "browser_action": { "default_popup": "index.html" }
Chrome extension render:
Expected render:
Everything else just works as expected:
If you need futher information please ask.