Handles focusout events for the menu trigger.
(event: FocusEvent)
| 719 | |
| 720 | /** Handles focusout events for the menu trigger. */ |
| 721 | onFocusOut(event: FocusEvent) { |
| 722 | const element = this.inputs.element(); |
| 723 | const relatedTarget = event.relatedTarget as Node | null; |
| 724 | |
| 725 | if ( |
| 726 | this.expanded() && |
| 727 | !element?.contains(relatedTarget) && |
| 728 | !this.inputs.menu()?.inputs.element()?.contains(relatedTarget) |
| 729 | ) { |
| 730 | this.close(); |
| 731 | } |
| 732 | } |
| 733 | |
| 734 | /** Opens the menu. */ |
| 735 | open(opts?: {first?: boolean; last?: boolean}) { |