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

Method _toggleMenuFocus

src/cdk/menu/menu.ts:109–129  ·  view source on GitHub ↗

* Set focus the either the current, previous or next item based on the FocusNext event. * @param focusNext The element to focus.

(focusNext: FocusNext | undefined)

Source from the content-addressed store, hash-verified

107 * @param focusNext The element to focus.
108 */
109 private _toggleMenuFocus(focusNext: FocusNext | undefined) {
110 const keyManager = this.keyManager;
111 switch (focusNext) {
112 case FocusNext.nextItem:
113 keyManager.setFocusOrigin('keyboard');
114 keyManager.setNextItemActive();
115 break;
116
117 case FocusNext.previousItem:
118 keyManager.setFocusOrigin('keyboard');
119 keyManager.setPreviousItemActive();
120 break;
121
122 case FocusNext.currentItem:
123 if (keyManager.activeItem) {
124 keyManager.setFocusOrigin('keyboard');
125 keyManager.setActiveItem(keyManager.activeItem);
126 }
127 break;
128 }
129 }
130
131 /** Subscribe to the MenuStack emptied events. */
132 private _subscribeToMenuStackEmptied() {

Callers 1

Calls 4

setFocusOriginMethod · 0.80
setNextItemActiveMethod · 0.80
setPreviousItemActiveMethod · 0.80
setActiveItemMethod · 0.45

Tested by

no test coverage detected