Skip to content

FullscreenOverlayContainer throws error in universal app #10978

Closed
@odahcam

Description

@odahcam

Bug, feature request, or proposal:

bug

What is the expected behavior?

No error thrown.

What is the current behavior?

Error is thrown.

What are the steps to reproduce?

Can't reproduce without SSR. Just put the following provider in a module rendered in the server:

import { OverlayModule, OverlayContainer, FullscreenOverlayContainer } from '@angular/cdk/overlay';

@NgModule({
    declarations: [
        SomeComponent
    ],
    imports: [
        CommonModule,
        OverlayModule
    ],
    providers: [
        { provide: OverlayContainer, useClass: FullscreenOverlayContainer }
    ],
    entryComponents: [
        SomeComponent
    ]
})
export class SomeModule { }

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Mat 5.2.4
Angular 5.2.8

Is there anything else we should know?

> cd dist && node server

Node Express server listening on http://localhost:4000
Running on the server with appId=com.<myhost>
zxing-scanner askForPermission Can't ask permission, navigator is not present.
ERROR ReferenceError: document is not defined
    at FullscreenOverlayContainer.getFullscreenElement (C:\<project-path>\dist\server.js:54416:9)
    at FullscreenOverlayContainer._adjustParentForFullscreenChange (C:\<project-path>\dist\server.js:54375:55)
    at FullscreenOverlayContainer._createContainer (C:\<project-path>\dist\server.js:54362:14)
    at FullscreenOverlayContainer.OverlayContainer.getContainerElement (C:\<project-path>\dist\server.js:53550:18)
    at Overlay._createPaneElement (C:\<project-path>\dist\server.js:53685:32)
    at Overlay.create (C:\<project-path>\dist\server.js:53651:42)
    at MatDialog._createOverlay (C:\<project-path>\dist\server.js:122168:30)
    at MatDialog.open (C:\<project-path>\dist\server.js:122106:48)
    at t.e.QrScannerComponent.t.onPermissionResponse (C:\<project-path>\dist\server.js:165814:392006)
    at C:\<project-path>\dist\server.js:165814:391179

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions