Validates that rendered input fields define a non-blank autocomplete attribute.
This check inspects rendered <input> elements that accept user-entered
values and flags fields without an explicit autocomplete purpose. Use a
specific autocomplete token where possible, or autocomplete="off" when a
field intentionally should not be autofilled.
Examples
Bad:
<input type="email" name="user[email]">Why this is bad:
The browser and assistive technology cannot identify the expected input purpose from the rendered markup.
Better:
<input type="email" name="user[email]" autocomplete="email">Why this is better:
The field exposes its input purpose in a machine-readable way.
Bad:
<input name="search" autocomplete="">Why this is bad:
A blank autocomplete value is equivalent to leaving the purpose unspecified.
Better:
<input name="search" autocomplete="off">Why this is better:
The rendered markup documents that autocomplete was considered and disabled intentionally.
Notes
This check ignores input controls where autocomplete is not meaningful:
button, checkbox, file, hidden, image, radio, reset, and
submit. Inputs without a type attribute are treated as text inputs.
The check only verifies that a non-blank autocomplete value is present. It
does not validate autocomplete token grammar or judge whether the chosen token
matches the field's semantic purpose.
This check runs on rendered HTML, so dynamic autocomplete attributes are
evaluated after rendering.
Options
This check has no check-specific options. Add the module directly to the explicit checks list:
Bylaw.HTML.Check.RequireInputAutocompleteUsage
Add this module to the explicit check list passed through Bylaw.HTML.
See Bylaw.HTML for the full rendered HTML validation setup.
Summary
Functions
Implements the Bylaw.HTML.Check validation callback.
Functions
@spec validate(Bylaw.HTML.Check.context()) :: Bylaw.HTML.Check.result()
Implements the Bylaw.HTML.Check validation callback.