MCPcopy Create free account
hub / github.com/angular/components / submit

Method submit

src/aria/private/menu/menu.ts:395–412  ·  view source on GitHub ↗

Submits the menu.

(item = this.inputs.activeItem())

Source from the content-addressed store, hash-verified

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

Callers 2

onClickMethod · 0.95
triggerMethod · 0.95

Calls 6

activeItemMethod · 0.80
disabledMethod · 0.45
closeMethod · 0.45
itemSelectedMethod · 0.45
menuMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected