The plugin added to fields by the scrollToErrorPlugin.

interface ScrollToErrorPlugin {
    element: null | Element;
    isInvalid?: boolean;
    ref(element): void;
    scrollToError(index?, alignToTop?): null | BareField<any, any>;
    scrollToError(index?, options?): 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

    • element: null | Element

    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

    • Optional index: 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).

    • Optional alignToTop: 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

    • Optional index: 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).

    • Optional options: ScrollToErrorOptions

    Returns null | BareField<any, any>

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