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