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

Method _handleKeydown

src/material/menu/menu-trigger.ts:178–194  ·  view source on GitHub ↗

Handles key presses on the trigger.

(event: KeyboardEvent)

Source from the content-addressed store, hash-verified

176
177 /** Handles key presses on the trigger. */
178 _handleKeydown(event: KeyboardEvent): void {
179 const keyCode = event.keyCode;
180
181 // Pressing enter on the trigger will trigger the click handler later.
182 if (keyCode === ENTER || keyCode === SPACE) {
183 this._openedBy = 'keyboard';
184 }
185
186 if (
187 this.triggersSubmenu() &&
188 ((keyCode === RIGHT_ARROW && this.dir === 'ltr') ||
189 (keyCode === LEFT_ARROW && this.dir === 'rtl'))
190 ) {
191 this._openedBy = 'keyboard';
192 this.openMenu();
193 }
194 }
195
196 /** Handles click events on the trigger. */
197 _handleClick(event: MouseEvent): void {

Callers

nothing calls this directly

Calls 2

triggersSubmenuMethod · 0.95
openMenuMethod · 0.95

Tested by

no test coverage detected