Handles focusout events for the menu trigger.
(event: FocusEvent)
| 711 | |
| 712 | /** Handles focusout events for the menu trigger. */ |
| 713 | onFocusOut(event: FocusEvent) { |
| 714 | const element = this.inputs.element(); |
| 715 | const relatedTarget = event.relatedTarget as Node | null; |
| 716 | |
| 717 | if ( |
| 718 | this.expanded() && |
| 719 | !element?.contains(relatedTarget) && |
| 720 | !this.inputs.menu()?.inputs.element()?.contains(relatedTarget) |
| 721 | ) { |
| 722 | this.close(); |
| 723 | } |
| 724 | } |
| 725 | |
| 726 | /** Opens the menu. */ |
| 727 | open(opts?: {first?: boolean; last?: boolean}) { |