fix(console): placeholder accessor (#6849)

* fix(console): placeholder accessor

* cleanup
This commit is contained in:
Max Peintner 2023-10-31 13:24:39 +01:00 committed by GitHub
parent a2a02598d0
commit 814e09f1d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -363,7 +363,8 @@ export class InputDirective
private _dirtyCheckPlaceholder(): void {
// If we're hiding the native placeholder, it should also be cleared from the DOM, otherwise
// screen readers will read it out twice: once from the label and once from the attribute.
const placeholder = null;
const placeholder = this._getPlaceholder();
if (placeholder !== this._previousPlaceholder) {
const element = this._elementRef.nativeElement;
this._previousPlaceholder = placeholder;
@ -371,6 +372,11 @@ export class InputDirective
}
}
/** Gets the current placeholder of the form field. */
protected _getPlaceholder(): string | null {
return this.placeholder || null;
}
/** Does some manual dirty checking on the native input `value` property. */
protected _dirtyCheckNativeValue(): void {
const newValue = this._elementRef.nativeElement.value;