Skip to content

mat-form-field does not display outline label properly in ShadowDom #17262

Closed
hrueger/AGLight
#112
@trungphan

Description

@trungphan

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/fork/components-issue

https://stackblitz.com/edit/angular-geqne7?file=app/form-field-appearance-example.ts

Steps to reproduce:

  1. Go to https://stackblitz.com/edit/angular-geqne7?file=app/form-field-appearance-example.ts
  2. Select the form field and see the outline label to be under the input outline

Expected Behavior

What behavior were you expecting to see?
The label should be on top of the input outline

This is because of the condition here:

https://github.com/angular/components/blob/master/src/material/form-field/form-field.ts#L532 in the method

updateOutlineGap() {
...
    if (!document.documentElement!.contains(this._elementRef.nativeElement)) {
      this._outlineGapCalculationNeededImmediately = true;
      return;
    }
...
}

Actual Behavior

What behavior did you actually see?

Environment

  • Angular: 8.2.1
  • CDK/Material:
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu): MacOS

Metadata

Metadata

Assignees

Labels

GThis is is related to a Google internal issueP2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions