Skip to content

Commit 147689a

Browse files
committed
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 147689a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,10 @@ 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') {
590+
console.log('doing split', this._control.userAriaDescribedBy);
588591
ids.push(...this._control.userAriaDescribedBy.split(' '));
589592
}
590593

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)