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

Method _handleKeydown

src/material/core/option/option.ts:230–237  ·  view source on GitHub ↗

Ensures the option is selected when activated from the keyboard.

(event: KeyboardEvent)

Source from the content-addressed store, hash-verified

228
229 /** Ensures the option is selected when activated from the keyboard. */
230 _handleKeydown(event: KeyboardEvent): void {
231 if ((event.keyCode === ENTER || event.keyCode === SPACE) && !hasModifierKey(event)) {
232 this._selectViaInteraction();
233
234 // Prevent the page from scrolling down and form submits.
235 event.preventDefault();
236 }
237 }
238
239 /**
240 * `Selects the option while indicating the selection came from the user. Used to

Callers

nothing calls this directly

Calls 2

_selectViaInteractionMethod · 0.95
hasModifierKeyFunction · 0.90

Tested by

no test coverage detected