Skip to content

Commit

Permalink
Add hidden attribute to the password show button
Browse files Browse the repository at this point in the history
This was missed when the password field was initially added. It means
the show/hide button can be rendered hidden and then shown if/when the
JavaScript kicks in. When missing the button is rendered and it doesn't
do anything.
  • Loading branch information
peteryates committed Apr 16, 2024
1 parent 58f5f0a commit 3328cd0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/govuk_design_system_formbuilder/elements/password.rb
Expand Up @@ -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
Expand Down
Expand Up @@ -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",
Expand Down

0 comments on commit 3328cd0

Please sign in to comment.