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

Method submit

src/aria/private/menu/menu.ts:411–428  ·  view source on GitHub ↗

Submits the menu.

(item = this.inputs.activeItem())

Source from the content-addressed store, hash-verified

409
410 /** Submits the menu. */
411 submit(item = this.inputs.activeItem()) {
412 if (!item || item.disabled() || item.submenu()) {
413 return;
414 }
415
416 const root = this.root();
417
418 if (root instanceof MenuTriggerPattern) {
419 root.close({refocus: true});
420 root?.inputs.menu()?.inputs.itemSelected?.(item.value());
421 } else if (root instanceof MenuBarPattern) {
422 root.close();
423 root?.inputs.itemSelected?.(item.value());
424 } else if (root instanceof MenuPattern) {
425 root.inputs.activeItem()?.close({refocus: true});
426 root?.inputs.itemSelected?.(item.value());
427 }
428 }
429
430 /** Collapses the current menu or focuses the previous item in the menubar. */
431 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