The plugin added to fields by the scrollToErrorPlugin.

interface ScrollToErrorPlugin {
    element: null | Element;
    isInvalid?: boolean;
    ref(element: null | Element): void;
    scrollToError(index?: number, alignToTop?: boolean): null | BareField<any, any>;
    scrollToError(index?: number, options?: ScrollToErrorOptions): null | BareField<any, any>;
}

Properties

element: null | Element

The DOM element associated with the field, or null if there's no associated element.

isInvalid?: boolean

true if this field has associated errors, or false otherwise.

Methods

  • Associates the field with the DOM element.

    Parameters

    Returns void

  • Scroll to the element that is referenced by an invalid field. Scrolls the field element's ancestor containers such that the field element is visible to the user.

    The field ref should be populated with an Element reference.

    Parameters

    • Optionalindex: number

      The zero-based index of an invalid field to scroll to. A negative index can be used, indicating an offset from the end of the sequence. scrollToError(-1) scroll to the last invalid field. The visual order of fields is used (by default left-to-right and top-to-bottom).

    • OptionalalignToTop: boolean

      If true, the top of the element will be aligned to the top of the visible area of the scrollable ancestor, otherwise element will be aligned to the bottom of the visible area of the scrollable ancestor.

    Returns null | BareField<any, any>

    The field which is scrolled to, or null if there's no scroll happening.

  • Scroll to the element that is referenced by an invalid field. Scrolls the field element's ancestor containers such that the field element is visible to the user.

    The field ref should be populated with an Element reference.

    Parameters

    • Optionalindex: number

      The zero-based index of an invalid field to scroll to. A negative index can be used, indicating an offset from the end of the sequence. scrollToError(-1) scroll to the last invalid field. The visual order of fields is used (by default left-to-right and top-to-bottom).

    • Optionaloptions: ScrollToErrorOptions

    Returns null | BareField<any, any>

    The field which is scrolled to, or null if there's no scroll happening.