Skip to content

Commit 5552abe

Browse files
wagnermacieljelbourn
authored andcommitted
fix(form-field): add a type check for userAriaDescribedBy
* Internal test was failing because userAriaDescribedBy showed up as an object so calling .split was throwing errors.
1 parent e00e7a1 commit 5552abe

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/material-experimental/mdc-form-field/form-field.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,9 @@ export class MatFormField implements AfterViewInit, OnDestroy, AfterContentCheck
584584
if (this._control) {
585585
let ids: string[] = [];
586586

587-
if (this._control.userAriaDescribedBy) {
587+
// TODO(wagnermaciel): Remove the type check when we find the root cause of this bug.
588+
if (this._control.userAriaDescribedBy &&
589+
typeof this._control.userAriaDescribedBy === 'string') {
588590
ids.push(...this._control.userAriaDescribedBy.split(' '));
589591
}
590592

src/material/form-field/form-field.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,9 @@ export class MatFormField extends _MatFormFieldMixinBase
507507
if (this._control) {
508508
let ids: string[] = [];
509509

510-
if (this._control.userAriaDescribedBy) {
510+
// TODO(wagnermaciel): Remove the type check when we find the root cause of this bug.
511+
if (this._control.userAriaDescribedBy &&
512+
typeof this._control.userAriaDescribedBy === 'string') {
511513
ids.push(...this._control.userAriaDescribedBy.split(' '));
512514
}
513515

0 commit comments

Comments
 (0)