Skip to content

Commit 35b3b73

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 35b3b73

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-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+
if (this._control.userAriaDescribedBy &&
588+
typeof this._control.userAriaDescribedBy === 'string') {
589+
console.log('doing split', this._control.userAriaDescribedBy);
588590
ids.push(...this._control.userAriaDescribedBy.split(' '));
589591
}
590592

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

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

510-
if (this._control.userAriaDescribedBy) {
510+
if (this._control.userAriaDescribedBy &&
511+
typeof this._control.userAriaDescribedBy === 'string') {
511512
ids.push(...this._control.userAriaDescribedBy.split(' '));
512513
}
513514

0 commit comments

Comments
 (0)