Handles focusout events for the menu trigger.
(event: FocusEvent)
| 742 | |
| 743 | /** Handles focusout events for the menu trigger. */ |
| 744 | onFocusOut(event: FocusEvent) { |
| 745 | const element = this.inputs.element(); |
| 746 | const relatedTarget = event.relatedTarget as Node | null; |
| 747 | |
| 748 | if ( |
| 749 | this.expanded() && |
| 750 | !element?.contains(relatedTarget) && |
| 751 | !this.inputs.menu()?.inputs.element()?.contains(relatedTarget) |
| 752 | ) { |
| 753 | this.close(); |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | /** Opens the menu. */ |
| 758 | open(opts?: {first?: boolean; last?: boolean}) { |