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

Method submit

src/aria/private/menu/menu.ts:391–408  ·  view source on GitHub ↗

Submits the menu.

(item = this.inputs.activeItem())

Source from the content-addressed store, hash-verified

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() {

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