-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix password input button unexpectedly stretching #4935
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes an issue where the password input toggle button would stretch to fill any space not used by the input, such as if the input has a restricted max width. I think the `flex-grow` property may have been a leftover from earlier in the component's development, as it doesn't appear to be needed now. Adds a review app example to help keep this in check in future.
querkmachine
force-pushed
the
fix-password-input-button-grow
branch
from
April 12, 2024 11:14
d4e0e62
to
456394f
Compare
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for 456394f |
Stylesheets changes to npm packagediff --git a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
index 2c37191c5..75a932582 100644
--- a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
+++ b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
@@ -4666,7 +4666,6 @@ only screen and (min-resolution:2dppx) {
@media (min-width:20em) {
.govuk-password-input__toggle {
width: auto;
- flex-grow: 1;
flex-shrink: 0;
flex-basis: 5em;
margin-top: 0;
Action run for 456394f |
Rendered HTML changes to npm packagediff --git a/packages/govuk-frontend/dist/govuk/components/password-input/template-with-input-width-class.html b/packages/govuk-frontend/dist/govuk/components/password-input/template-with-input-width-class.html
new file mode 100644
index 000000000..50b62f217
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/password-input/template-with-input-width-class.html
@@ -0,0 +1,11 @@
+<div class="govuk-form-group govuk-password-input" data-module="govuk-password-input">
+ <label class="govuk-label" for="password-input-width">
+ Password
+ </label>
+ <div class="govuk-input__wrapper govuk-password-input__wrapper">
+ <input class="govuk-input govuk-password-input__input govuk-js-password-input-input govuk-input--width-10" id="password-input-width" name="password" type="password" spellcheck="false" autocomplete="current-password" autocapitalize="none">
+ <button type="button" class="govuk-button govuk-button--secondary govuk-password-input__toggle govuk-js-password-input-toggle" data-module="govuk-button" aria-controls="password-input-width" aria-label="Show password" hidden>
+ Show
+ </button>
+ </div>
+</div>
Action run for 456394f |
Other changes to npm packagediff --git a/packages/govuk-frontend/dist/govuk/components/password-input/_index.scss b/packages/govuk-frontend/dist/govuk/components/password-input/_index.scss
index 0fa68d8b4..a1dc27047 100644
--- a/packages/govuk-frontend/dist/govuk/components/password-input/_index.scss
+++ b/packages/govuk-frontend/dist/govuk/components/password-input/_index.scss
@@ -20,7 +20,7 @@
// IE 11 and Microsoft Edge comes with its own password reveal function. We want to hide it,
// so that there aren't two controls presented to the user that do the same thing but aren't in
// sync with one another. This doesn't affect the function that allows Edge users to toggle
- // password visibility by pressing Alt+F8, which cannot be programatically disabled.
+ // password visibility by pressing Alt+F8, which cannot be programmatically disabled.
&::-ms-reveal {
display: none;
}
@@ -41,7 +41,6 @@
@include govuk-media-query($from: mobile) {
// Buttons are normally 100% width on this breakpoint, but we don't want that in this case
width: auto;
- flex-grow: 1;
flex-shrink: 0;
flex-basis: 5em;
diff --git a/packages/govuk-frontend/dist/govuk/components/password-input/fixtures.json b/packages/govuk-frontend/dist/govuk/components/password-input/fixtures.json
index 5c14c2ad4..f4e99d0e1 100644
--- a/packages/govuk-frontend/dist/govuk/components/password-input/fixtures.json
+++ b/packages/govuk-frontend/dist/govuk/components/password-input/fixtures.json
@@ -68,6 +68,21 @@
"previewLayoutModifiers": [],
"html": "<div class=\"govuk-form-group govuk-password-input\" data-module=\"govuk-password-input\">\n <h1 class=\"govuk-label-wrapper\">\n <label class=\"govuk-label govuk-label--l\" for=\"password-input-with-page-heading\">\n Password\n </label>\n </h1>\n <div class=\"govuk-input__wrapper govuk-password-input__wrapper\">\n <input class=\"govuk-input govuk-password-input__input govuk-js-password-input-input\" id=\"password-input-with-page-heading\" name=\"test-name\" type=\"password\" spellcheck=\"false\" autocomplete=\"current-password\" autocapitalize=\"none\">\n <button type=\"button\" class=\"govuk-button govuk-button--secondary govuk-password-input__toggle govuk-js-password-input-toggle\" data-module=\"govuk-button\" aria-controls=\"password-input-with-page-heading\" aria-label=\"Show password\" hidden>\n Show\n </button>\n </div>\n</div>"
},
+ {
+ "name": "with input width class",
+ "options": {
+ "label": {
+ "text": "Password"
+ },
+ "id": "password-input-width",
+ "name": "password",
+ "classes": "govuk-input--width-10"
+ },
+ "hidden": false,
+ "description": "",
+ "previewLayoutModifiers": [],
+ "html": "<div class=\"govuk-form-group govuk-password-input\" data-module=\"govuk-password-input\">\n <label class=\"govuk-label\" for=\"password-input-width\">\n Password\n </label>\n <div class=\"govuk-input__wrapper govuk-password-input__wrapper\">\n <input class=\"govuk-input govuk-password-input__input govuk-js-password-input-input govuk-input--width-10\" id=\"password-input-width\" name=\"password\" type=\"password\" spellcheck=\"false\" autocomplete=\"current-password\" autocapitalize=\"none\">\n <button type=\"button\" class=\"govuk-button govuk-button--secondary govuk-password-input__toggle govuk-js-password-input-toggle\" data-module=\"govuk-button\" aria-controls=\"password-input-width\" aria-label=\"Show password\" hidden>\n Show\n </button>\n </div>\n</div>"
+ },
{
"name": "with new-password autocomplete",
"options": {
@@ -79,7 +94,7 @@
"name": "password"
},
"hidden": false,
- "description": "Browsers and password managers should prompt to generate a password.",
+ "description": "Supporting browsers and password managers should prompt to generate a password.",
"previewLayoutModifiers": [],
"html": "<div class=\"govuk-form-group govuk-password-input\" data-module=\"govuk-password-input\">\n <label class=\"govuk-label\" for=\"password-input-new-password\">\n Password\n </label>\n <div class=\"govuk-input__wrapper govuk-password-input__wrapper\">\n <input class=\"govuk-input govuk-password-input__input govuk-js-password-input-input\" id=\"password-input-new-password\" name=\"password\" type=\"password\" spellcheck=\"false\" autocomplete=\"new-password\" autocapitalize=\"none\">\n <button type=\"button\" class=\"govuk-button govuk-button--secondary govuk-password-input__toggle govuk-js-password-input-toggle\" data-module=\"govuk-button\" aria-controls=\"password-input-new-password\" aria-label=\"Show password\" hidden>\n Show\n </button>\n </div>\n</div>"
},
Action run for 456394f |
owenatgov
approved these changes
Apr 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easy peasy
Merged
This was referenced Jun 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes issue where the Password input toggle button unexpectedly stretched to fill any space not used by the text input, such as if the input has a restricted maximum width.
I think the
flex-grow
property may have been a leftover from earlier in the component's development, as it doesn't appear to serve any function in the current version of the component.Fixes #4934.
Changes
flex-grow
property from the Password input toggle button.