• Sets focus to the specified target. Specify additional options to refine the focus operation.

    Note that we don't throw if the target is null because it may not exist yet if a css!CssSelector is specified.

    Type Parameters

    Parameters

    • target: undefined | null | Target

      Element, EventTarget, or CSS selector.

    • Optionaloptions: FocusOptions<E>

      Options for setting focus.

      • Optionaldelay?: number

        Delay (in milliseconds) to wait until attempting to set focus.

      • Optionalparent?: Target

        Parent element (if target is a css!CssSelector).

      • OptionalpreventScroll?: boolean

        If true, don't scroll the focused element into view. See the MDN documentation for preventScroll for additional details.

      • onDone?:function

    Returns void