MCPcopy Index your code
hub / github.com/angular/components / _handleKeydown

Method _handleKeydown

src/material/timepicker/timepicker.ts:466–491  ·  view source on GitHub ↗

Handles keyboard events while the overlay is open.

(event: KeyboardEvent)

Source from the content-addressed store, hash-verified

464
465 /** Handles keyboard events while the overlay is open. */
466 private _handleKeydown(event: KeyboardEvent): void {
467 const keyCode = event.keyCode;
468
469 if (keyCode === TAB) {
470 this.close();
471 } else if (keyCode === ESCAPE && !hasModifierKey(event)) {
472 event.preventDefault();
473 this.close();
474 } else if (keyCode === ENTER) {
475 event.preventDefault();
476
477 if (this._keyManager.activeItem) {
478 this._selectValue(this._keyManager.activeItem);
479 } else {
480 this.close();
481 }
482 } else {
483 const previousActive = this._keyManager.activeItem;
484 this._keyManager.onKeydown(event);
485 const currentActive = this._keyManager.activeItem;
486
487 if (currentActive && currentActive !== previousActive) {
488 scrollOptionIntoView(currentActive, 'nearest');
489 }
490 }
491 }
492
493 /** Sets up the logic that updates the timepicker when the locale changes. */
494 private _handleLocaleChanges(): void {

Callers 1

_getOverlayRefMethod · 0.95

Calls 5

closeMethod · 0.95
_selectValueMethod · 0.95
hasModifierKeyFunction · 0.90
scrollOptionIntoViewFunction · 0.85
onKeydownMethod · 0.65

Tested by

no test coverage detected