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