diff --git a/lib/govuk_design_system_formbuilder/elements/password.rb b/lib/govuk_design_system_formbuilder/elements/password.rb index 8476080d..0581de12 100644 --- a/lib/govuk_design_system_formbuilder/elements/password.rb +++ b/lib/govuk_design_system_formbuilder/elements/password.rb @@ -85,6 +85,7 @@ def button_options data: { module: %(#{brand}-button) }, aria: { label: "Show password", controls: field_id(link_errors: true) }, type: 'button', + hidden: true, class: %w(button button--secondary password-input__toggle js-password-input-toggle).prefix(brand) } end diff --git a/spec/govuk_design_system_formbuilder/builder/password_spec.rb b/spec/govuk_design_system_formbuilder/builder/password_spec.rb index 6f0e782f..8313f4ab 100644 --- a/spec/govuk_design_system_formbuilder/builder/password_spec.rb +++ b/spec/govuk_design_system_formbuilder/builder/password_spec.rb @@ -48,6 +48,7 @@ specify 'the button has the right attributes' do expected_attributes = { + "hidden" => "hidden", "data-module" => "govuk-button", "aria-label" => "Show password", "aria-controls" => "person-password-field",