Handles focusout events for the menu trigger.
(event: FocusEvent)
| 751 | |
| 752 | /** Handles focusout events for the menu trigger. */ |
| 753 | onFocusOut(event: FocusEvent) { |
| 754 | const element = this.inputs.element(); |
| 755 | const relatedTarget = event.relatedTarget as Node | null; |
| 756 | |
| 757 | if ( |
| 758 | this.expanded() && |
| 759 | !element?.contains(relatedTarget) && |
| 760 | !this.inputs.menu()?.inputs.element()?.contains(relatedTarget) |
| 761 | ) { |
| 762 | this.close(); |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | /** Opens the menu. */ |
| 767 | open(opts?: {first?: boolean; last?: boolean}) { |