()
| 546 | } |
| 547 | |
| 548 | private _updateFocusState() { |
| 549 | const controlFocused = this._control.focused; |
| 550 | |
| 551 | // Usually the MDC foundation would call "activateFocus" and "deactivateFocus" whenever |
| 552 | // certain DOM events are emitted. This is not possible in our implementation of the |
| 553 | // form field because we support abstract form field controls which are not necessarily |
| 554 | // of type input, nor do we have a reference to a native form field control element. Instead |
| 555 | // we handle the focus by checking if the abstract form field control focused state changes. |
| 556 | if (controlFocused && !this._isFocused) { |
| 557 | this._isFocused = true; |
| 558 | this._lineRipple?.activate(); |
| 559 | } else if (!controlFocused && (this._isFocused || this._isFocused === null)) { |
| 560 | this._isFocused = false; |
| 561 | this._lineRipple?.deactivate(); |
| 562 | } |
| 563 | |
| 564 | this._elementRef.nativeElement.classList.toggle('mat-focused', controlFocused); |
| 565 | this._textField?.nativeElement.classList.toggle('mdc-text-field--focused', controlFocused); |
| 566 | } |
| 567 | |
| 568 | /** |
| 569 | * The floating label in the docked state needs to account for prefixes. The horizontal offset |
no test coverage detected