Submits the menu.
(item = this.inputs.activeItem())
| 389 | |
| 390 | /** Submits the menu. */ |
| 391 | submit(item = this.inputs.activeItem()) { |
| 392 | if (!item || item.disabled() || item.submenu()) { |
| 393 | return; |
| 394 | } |
| 395 | |
| 396 | const root = this.root(); |
| 397 | |
| 398 | if (root instanceof MenuTriggerPattern) { |
| 399 | root.close({refocus: true}); |
| 400 | root?.inputs.menu()?.inputs.itemSelected?.(item.value()); |
| 401 | } else if (root instanceof MenuBarPattern) { |
| 402 | root.close(); |
| 403 | root?.inputs.itemSelected?.(item.value()); |
| 404 | } else if (root instanceof MenuPattern) { |
| 405 | root.inputs.activeItem()?.close({refocus: true}); |
| 406 | root?.inputs.itemSelected?.(item.value()); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | /** Collapses the current menu or focuses the previous item in the menubar. */ |
| 411 | collapse() { |
no test coverage detected