Join us online - 19th of November
Save your spot
For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface ElementInternals

The ElementInternals interface of the Document Object Model gives web developers a way to allow custom elements to fully participate in HTML forms. It provides utilities for working with these elements in the same way you would work with any standard HTML form element, and also exposes the Accessibility Object Model to the element.

MDN Reference

interface ElementInternals {
    ariaActiveDescendantElement: Element | null;
    ariaAtomic: string | null;
    ariaAutoComplete: string | null;
    ariaBrailleLabel: string | null;
    ariaBrailleRoleDescription: string | null;
    ariaBusy: string | null;
    ariaChecked: string | null;
    ariaColCount: string | null;
    ariaColIndex: string | null;
    ariaColIndexText: string | null;
    ariaColSpan: string | null;
    ariaControlsElements: readonly Element[] | null;
    ariaCurrent: string | null;
    ariaDescribedByElements: readonly Element[] | null;
    ariaDescription: string | null;
    ariaDetailsElements: readonly Element[] | null;
    ariaDisabled: string | null;
    ariaErrorMessageElements: readonly Element[] | null;
    ariaExpanded: string | null;
    ariaFlowToElements: readonly Element[] | null;
    ariaHasPopup: string | null;
    ariaHidden: string | null;
    ariaInvalid: string | null;
    ariaKeyShortcuts: string | null;
    ariaLabel: string | null;
    ariaLabelledByElements: readonly Element[] | null;
    ariaLevel: string | null;
    ariaLive: string | null;
    ariaModal: string | null;
    ariaMultiLine: string | null;
    ariaMultiSelectable: string | null;
    ariaOrientation: string | null;
    ariaOwnsElements: readonly Element[] | null;
    ariaPlaceholder: string | null;
    ariaPosInSet: string | null;
    ariaPressed: string | null;
    ariaReadOnly: string | null;
    ariaRelevant: string | null;
    ariaRequired: string | null;
    ariaRoleDescription: string | null;
    ariaRowCount: string | null;
    ariaRowIndex: string | null;
    ariaRowIndexText: string | null;
    ariaRowSpan: string | null;
    ariaSelected: string | null;
    ariaSetSize: string | null;
    ariaSort: string | null;
    ariaValueMax: string | null;
    ariaValueMin: string | null;
    ariaValueNow: string | null;
    ariaValueText: string | null;
    form: HTMLFormElement | null;
    labels: NodeList;
    role: string | null;
    shadowRoot: ShadowRoot | null;
    states: CustomStateSet;
    validationMessage: string;
    validity: ValidityState;
    willValidate: boolean;
    checkValidity(): boolean;
    reportValidity(): boolean;
    setFormValue(
        value: string | File | FormData | null,
        state?: string | File | FormData | null,
    ): void;
    setValidity(
        flags?: ValidityStateFlags,
        message?: string,
        anchor?: HTMLElement,
    ): void;
}

Hierarchy (View Summary)

Index
ariaActiveDescendantElement: Element | null
ariaAtomic: string | null
ariaAutoComplete: string | null
ariaBrailleLabel: string | null
ariaBrailleRoleDescription: string | null
ariaBusy: string | null
ariaChecked: string | null
ariaColCount: string | null
ariaColIndex: string | null
ariaColIndexText: string | null
ariaColSpan: string | null
ariaControlsElements: readonly Element[] | null
ariaCurrent: string | null
ariaDescribedByElements: readonly Element[] | null
ariaDescription: string | null
ariaDetailsElements: readonly Element[] | null
ariaDisabled: string | null
ariaErrorMessageElements: readonly Element[] | null
ariaExpanded: string | null
ariaFlowToElements: readonly Element[] | null
ariaHasPopup: string | null
ariaHidden: string | null
ariaInvalid: string | null
ariaKeyShortcuts: string | null
ariaLabel: string | null
ariaLabelledByElements: readonly Element[] | null
ariaLevel: string | null
ariaLive: string | null
ariaModal: string | null
ariaMultiLine: string | null
ariaMultiSelectable: string | null
ariaOrientation: string | null
ariaOwnsElements: readonly Element[] | null
ariaPlaceholder: string | null
ariaPosInSet: string | null
ariaPressed: string | null
ariaReadOnly: string | null
ariaRelevant: string | null
ariaRequired: string | null
ariaRoleDescription: string | null
ariaRowCount: string | null
ariaRowIndex: string | null
ariaRowIndexText: string | null
ariaRowSpan: string | null
ariaSelected: string | null
ariaSetSize: string | null
ariaSort: string | null
ariaValueMax: string | null
ariaValueMin: string | null
ariaValueNow: string | null
ariaValueText: string | null
form: HTMLFormElement | null

The form read-only property of the ElementInternals interface returns the HTMLFormElement associated with this element.

MDN Reference

labels: NodeList

The labels read-only property of the ElementInternals interface returns the labels associated with the element.

MDN Reference

role: string | null
shadowRoot: ShadowRoot | null

The shadowRoot read-only property of the ElementInternals interface returns the ShadowRoot for this element.

MDN Reference

The states read-only property of the ElementInternals interface returns a CustomStateSet representing the possible states of the custom element.

MDN Reference

validationMessage: string

The validationMessage read-only property of the ElementInternals interface returns the validation message for the element.

MDN Reference

validity: ValidityState

The validity read-only property of the ElementInternals interface returns a ValidityState object which represents the different validity states the element can be in, with respect to constraint validation.

MDN Reference

willValidate: boolean

The willValidate read-only property of the ElementInternals interface returns true if the element is a submittable element that is a candidate for constraint validation.

MDN Reference

  • The checkValidity() method of the ElementInternals interface checks if the element meets any constraint validation rules applied to it.

    MDN Reference

    Returns boolean

  • The reportValidity() method of the ElementInternals interface checks if the element meets any constraint validation rules applied to it.

    MDN Reference

    Returns boolean

  • The setFormValue() method of the ElementInternals interface sets the element's submission value and state, communicating these to the user agent.

    MDN Reference

    Parameters

    • value: string | File | FormData | null
    • Optionalstate: string | File | FormData | null

    Returns void

Was this helpful?