* Called when the focus leaves an element in the listbox. * @param event The focusout event
(event: FocusEvent)
| 826 | * @param event The focusout event |
| 827 | */ |
| 828 | protected _handleFocusOut(event: FocusEvent) { |
| 829 | // Some browsers (e.g. Chrome and Firefox) trigger the focusout event when the user returns back to the document. |
| 830 | // To prevent losing the active option in this case, we store it in `_previousActiveOption` and restore it on the window `blur` event |
| 831 | // This ensures that the `activeItem` matches the actual focused element when the user returns to the document. |
| 832 | this._previousActiveOption = this.listKeyManager.activeItem; |
| 833 | |
| 834 | const otherElement = event.relatedTarget as Element; |
| 835 | if (this.element !== otherElement && !this.element.contains(otherElement)) { |
| 836 | this._onTouched(); |
| 837 | this._hasFocus = false; |
| 838 | this._setNextFocusToSelectedOption(); |
| 839 | } |
| 840 | } |
| 841 | |
| 842 | /** Get the id of the active option if active descendant is being used. */ |
| 843 | protected _getAriaActiveDescendant(): string | null | undefined { |
nothing calls this directly
no test coverage detected