Skip to content

Commit

Permalink
Fixes #38217 - Set autocomplete attribute on name inputs
Browse files Browse the repository at this point in the history
to prevent a password manager from suggesting saved credentials in
various name fields.
  • Loading branch information
adamruzicka committed Feb 17, 2025
1 parent 71fc34b commit aa916b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/helpers/form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ module FormHelper
def text_f(f, attr, options = {})
field(f, attr, options) do
addClass options, "form-control"
options[:focus_on_load] = true if options[:focus_on_load].nil? && attr.to_s == 'name'
if attr.to_s == 'name'
options[:focus_on_load] ||= true
options[:autocomplete] ||= "section-#{f.object_name} name"
end
f.text_field attr, options
end
end
Expand Down

0 comments on commit aa916b0

Please sign in to comment.