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

Method focus

src/material/core/option/option.ts:190–198  ·  view source on GitHub ↗

Sets focus onto this option.

(_origin?: FocusOrigin, options?: FocusOptions)

Source from the content-addressed store, hash-verified

188
189 /** Sets focus onto this option. */
190 focus(_origin?: FocusOrigin, options?: FocusOptions): void {
191 // Note that we aren't using `_origin`, but we need to keep it because some internal consumers
192 // use `MatOption` in a `FocusKeyManager` and we need it to match `FocusableOption`.
193 const element = this._getHostElement();
194
195 if (typeof element.focus === 'function') {
196 element.focus(options);
197 }
198 }
199
200 /**
201 * This method sets display styles on the option to make it appear

Callers

nothing calls this directly

Calls 2

_getHostElementMethod · 0.95
focusMethod · 0.65

Tested by

no test coverage detected