Repository navigation
Conversation
…ea form fields Only output the default `autocomplete="off"` attribute when the field does not define a custom `autocomplete` attribute, matching the existing behavior in `_field_password.php`.
|
No actionable comments were generated in the recent review. WalkthroughThe number, text, and textarea templates now add Estimated code review effort: 1 (Trivial) | ~3 minutes Merge Risk:
|
Summary
Prevents duplicate
autocompleteattributes when a customautocompleteattribute is configured ontext,number, ortextareabackend form fields.Problem
Currently,
_field_text.php,_field_number.php, and_field_textarea.phphardcodeautocomplete="off"before<?= $field->getAttributes() ?>. When a field defines a customautocompleteattribute in its YAML or PHP config, e.g.:the rendered HTML outputs two
autocompleteattributes (autocomplete="off" autocomplete="street-address"), causing browsers to ignore the custom value.Solution
Conditionally render
autocomplete="off"only when$field->hasAttribute('autocomplete')isfalse, matching the existing pattern inmodules/backend/widgets/form/partials/_field_password.php:Updated partials:
modules/backend/widgets/form/partials/_field_text.phpmodules/backend/widgets/form/partials/_field_number.phpmodules/backend/widgets/form/partials/_field_textarea.phpBackwards Compatibility
Fully backwards-compatible: fields without a custom
autocompleteattribute continue to renderautocomplete="off"as before.Summary by CodeRabbit
off.autocomplete="off".