Closes the submenu.
(opts: {refocus?: boolean} = {})
| 895 | |
| 896 | /** Closes the submenu. */ |
| 897 | close(opts: {refocus?: boolean} = {}) { |
| 898 | this._expanded.set(false); |
| 899 | this.pendingFocus.set(null); |
| 900 | |
| 901 | if (opts.refocus) { |
| 902 | this.inputs.parent()?.listBehavior.goto(this); |
| 903 | } |
| 904 | |
| 905 | let menuitems = this.inputs.submenu()?.inputs.items() ?? []; |
| 906 | |
| 907 | while (menuitems.length) { |
| 908 | const menuitem = menuitems.pop(); |
| 909 | menuitem?._expanded.set(false); |
| 910 | menuitem?.inputs.parent()?.listBehavior.unfocus(); |
| 911 | menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []); |
| 912 | |
| 913 | const parent = menuitem?.inputs.parent(); |
| 914 | |
| 915 | if (parent instanceof MenuPattern) { |
| 916 | parent._clearTimeouts(); |
| 917 | } |
| 918 | } |
| 919 | } |
| 920 | |
| 921 | /** Handles focusin events for the menu item. */ |
| 922 | onFocusIn() { |
nothing calls this directly
no test coverage detected