()
| 561 | } |
| 562 | |
| 563 | private _updateFocusState() { |
| 564 | const controlFocused = this._unwrapMaybeSignal(this._control.focused); |
| 565 | |
| 566 | // Usually the MDC foundation would call "activateFocus" and "deactivateFocus" whenever |
| 567 | // certain DOM events are emitted. This is not possible in our implementation of the |
| 568 | // form field because we support abstract form field controls which are not necessarily |
| 569 | // of type input, nor do we have a reference to a native form field control element. Instead |
| 570 | // we handle the focus by checking if the abstract form field control focused state changes. |
| 571 | if (controlFocused && !this._isFocused) { |
| 572 | this._isFocused = true; |
| 573 | this._lineRipple?.activate(); |
| 574 | } else if (!controlFocused && (this._isFocused || this._isFocused === null)) { |
| 575 | this._isFocused = false; |
| 576 | this._lineRipple?.deactivate(); |
| 577 | } |
| 578 | |
| 579 | this._elementRef.nativeElement.classList.toggle('mat-focused', controlFocused); |
| 580 | this._textField?.nativeElement.classList.toggle('mdc-text-field--focused', controlFocused); |
| 581 | } |
| 582 | |
| 583 | /** |
| 584 | * The floating label in the docked state needs to account for prefixes. The horizontal offset |
no test coverage detected