From 814e09f1d5abba50b8799edc798273311e18d923 Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Tue, 31 Oct 2023 13:24:39 +0100 Subject: [PATCH] fix(console): placeholder accessor (#6849) * fix(console): placeholder accessor * cleanup --- console/src/app/modules/input/input.directive.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/console/src/app/modules/input/input.directive.ts b/console/src/app/modules/input/input.directive.ts index ca160b680..a7e2f644f 100644 --- a/console/src/app/modules/input/input.directive.ts +++ b/console/src/app/modules/input/input.directive.ts @@ -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;