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

Function _handleKeydown

src/material/tabs/paginated-tab-header.ts:336–357  ·  view source on GitHub ↗

Handles keyboard events on the header.

(event: KeyboardEvent)

Source from the content-addressed store, hash-verified

334
335 /** Handles keyboard events on the header. */
336 _handleKeydown(event: KeyboardEvent) {
337 // We don't handle any key bindings with a modifier key.
338 if (hasModifierKey(event)) {
339 return;
340 }
341
342 switch (event.keyCode) {
343 case ENTER:
344 case SPACE:
345 if (this.focusIndex !== this.selectedIndex) {
346 const item = this._items.get(this.focusIndex);
347
348 if (item && !item.disabled) {
349 this.selectFocusedIndex.emit(this.focusIndex);
350 this._itemSelected(event);
351 }
352 }
353 break;
354 default:
355 this._keyManager?.onKeydown(event);
356 }
357 }
358
359 /**
360 * Callback for when the MutationObserver detects that the content has changed.

Callers

nothing calls this directly

Calls 4

hasModifierKeyFunction · 0.90
getMethod · 0.65
onKeydownMethod · 0.65
_itemSelectedMethod · 0.45

Tested by

no test coverage detected