Closes the submenu.
(opts: {refocus?: boolean} = {})
| 845 | |
| 846 | /** Closes the submenu. */ |
| 847 | close(opts: {refocus?: boolean} = {}) { |
| 848 | this._expanded.set(false); |
| 849 | |
| 850 | if (opts.refocus) { |
| 851 | this.inputs.parent()?.listBehavior.goto(this); |
| 852 | } |
| 853 | |
| 854 | let menuitems = this.inputs.submenu()?.inputs.items() ?? []; |
| 855 | |
| 856 | while (menuitems.length) { |
| 857 | const menuitem = menuitems.pop(); |
| 858 | menuitem?._expanded.set(false); |
| 859 | menuitem?.inputs.parent()?.listBehavior.unfocus(); |
| 860 | menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []); |
| 861 | |
| 862 | const parent = menuitem?.inputs.parent(); |
| 863 | |
| 864 | if (parent instanceof MenuPattern) { |
| 865 | parent._clearTimeouts(); |
| 866 | } |
| 867 | } |
| 868 | } |
| 869 | |
| 870 | /** Handles focusin events for the menu item. */ |
| 871 | onFocusIn() { |
nothing calls this directly
no test coverage detected