Skip to main content

Interface: UseAutofillSubmitOptions<TName>

Defined in: use-autofill-submit.ts:26

Options for useAutofillSubmit.

Type Parameters​

TName​

TName extends string

Properties​

enabled?​

optional enabled?: boolean

Defined in: use-autofill-submit.ts:35

Turn the watcher off without unmounting. Defaults to true.


fields​

fields: readonly TName[]

Defined in: use-autofill-submit.ts:33

name of every field that must be filled before submitting. All of them must satisfy UseAutofillSubmitOptions.isFilled, so a manager that fills only the password on a blank email stays quiet. Inline array literals are fine; only the names' contents matter.


interactionEvents?​

optional interactionEvents?: readonly (keyof HTMLElementEventMap)[]

Defined in: use-autofill-submit.ts:42

Events on the form that count as the user being present. Defaults to keydown, pointerdown and touchstart.


isFilled?​

optional isFilled?: (value, name, element) => boolean

Defined in: use-autofill-submit.ts:50

Decide whether a field counts as filled. Defaults to a non-empty value.

Parameters​

value​

string

name​

TName

element​

AutofillField

Returns​

boolean


onAutofill?​

optional onAutofill?: (context) => boolean | void

Defined in: use-autofill-submit.ts:55

Called when a complete fill is detected, right before submitting. Return false to veto it; the hook stays armed and tries again on the next fill.

Parameters​

context​

AutofillContext<TName>

Returns​

boolean | void


pollInterval?​

optional pollInterval?: number

Defined in: use-autofill-submit.ts:37

How often, in milliseconds, field values are sampled. Defaults to 250.


requireInteraction?​

optional requireInteraction?: boolean

Defined in: use-autofill-submit.ts:48

Require one of UseAutofillSubmitOptions.interactionEvents before anything auto-submits, so credentials restored on page load can never sign someone straight back in. Defaults to true.


submit?​

optional submit?: (context) => void

Defined in: use-autofill-submit.ts:60

Replace how the form is submitted. Defaults to form.requestSubmit() (after reportValidity()), which takes the form's own onSubmit path.

Parameters​

context​

AutofillContext<TName>

Returns​

void