-
Notifications
You must be signed in to change notification settings - Fork 99
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
feat(login): adds a password strength demo #4145
Conversation
Preview: https://patternfly-pr-4145.surge.sh A11y report: https://patternfly-pr-4145-coverage.surge.sh
|
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.
This looks great!! A couple of questions for @mcarrano
- This is built as a demo - there were no enhancements to the login component to support this PR. The way the helper text that is adjacent to the label when it's above the text input is using a split layout in the demo. We may get variation in use in products if the way we put helper text adjacent to the label isn't built into the form or login component itself. This would also need to be built differently if a horizontal form were used. This seems OK, but I wanted to confirm whether the intent was for it to be purely a demo or if we want to build support for helper text by the form label into the form or login component.
- We typically do not use beta components in other component examples/demos, so we don't give the impression the component is ready to use. It's definitely a login page demo, but I wonder if it belongs under the helper text demos since it's beta?
@srambach the ultimate goal for the helper text component is to replace the current helper text elements we have in individual components. In this demo, the helper text component is placed after the text input with a margin from a utility class. I think we could go ahead and use/add an element in the form component that has the proper spacing for helper text in relation to a form field, and place the helper text component inside of that. Looking at the .pf-c-form__helper-text
element, that seems generic enough (maybe except for the font-size
declaration) to be able to support putting the helper text component inside. The font-size
won't conflict here though since the helper text component's font-size
is the same. WDYT?
@mcoker there seems to be a problem here because |
I think this is OK. I had thought at times whether we should define a unique Password component that includes all of these capabilities, but seems like that's overkill. Do you agree @mcoker ? I think we can provide guidelines around usage of the password strength in the the design guidelines to drive consistent usage.
I see your point, @mcoker , but I don't think anyone would look for this there. Is it possible to mark this specific example/demo as Beta since it uses a beta component? |
This isn't part of the login page. It would be for an account creation form, not a login form once the password is already created. |
That's a great point @ajacobs21e . I had wrongly been thinking of this as associated with the password field on Login. In that case, I think we should have two separate demos. One that is associated with the Helper Text component and shows how to use that for field validation and separately to demonstrate how to add password strength. I'm not sure where we add the later. @mcoker is this just a demo of how to add this to a form field? Do you think we would create something unique called Password strength and add to the Demo section? |
@mcarrano yep, we're just demoing how to use the helper text with a form field. I think the password strength demo could be a unique demo, especially since it's tied to multiple components. And since it's in it's own section, we could create a few examples showing the various states. |
@srambach nice catch! Looking at https://www.patternfly.org/v4/components/form, all of the helper text is a Though there is a If the preferred use of helper text in a form is to use the For the purposes of this PR, I think it's fair to assume I'm also curious from @kmcfaul, @tlabaj, and @jessiehuff on that change, as well as how they would envision using the helper text component to add helper text to a form field. |
@mcoker Right now the react component accepts any React node for the |
fae6574
to
55de8ac
Compare
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.
Just a few small comments, though a bigger issue is the use of the split to have the helper text beside the form label. Left a comment about that. If we can't figure out a solution, I'd be fine with just omitting that part of the demo (the text beside the label for the strength text) and following up with that next sprint.
{{#if form-helper-text--attribute}} | ||
{{{form-helper-text--attribute}}} | ||
{{/if}}> | ||
{{> @partial-block}} | ||
</p> | ||
</{{#if form-helper-text--type}} |
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.
nit - typically we'll make this a single line like the opening tag for consistency an easy whitespace management.
### Initial state | ||
```hbs | ||
{{#> form}} | ||
{{#> form-group}} |
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.
Looks like we're missing {{#> form-group-label}}
and {{#> form-group-control}}
around the form controls. And the helper text will go in form-group-control
.
{{#> form-group}} | ||
{{#> split split--modifier="pf-m-gutter"}} | ||
{{#> split-item split-item--modifier="pf-m-fill"}} | ||
{{#> form-label form-label--attribute='for="invalid-login-demo-form-password"' required="true"}}Password{{/form-label}} |
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.
One thing we do a lot is give the {{#> form}}
block a form--id="helper-text-invalid"
, then do form-label--attribute=(concat 'for="' form--id '-password"')
, so we can use that anywhere we need a unique string that's used multiple places in an example, then use that same code in each example with a unique form--id
.
{{/split-item}} | ||
{{/split}} | ||
{{#> input-group}} | ||
{{#> form-control controlType="input" input="true" form-control--attribute='type="search" id="invalid-login-demo-form-password" name="invalid-login-demo-form-password" aria-label="Password input" value="" placeholder="Password"'}} |
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.
type="search"
should be type="text"
?
{{/form}} | ||
``` | ||
|
||
### Valid, but weak password |
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.
nit - just to match the next example
### Valid, but weak password | |
### Valid, weak password |
```hbs | ||
{{#> form}} | ||
{{#> form-group}} | ||
{{#> split split--modifier="pf-m-gutter"}} |
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.
Looking at this split a little more, I don't know that we can do this in react. The <FormGroup>
component takes a label
for the label, and its children are passed into the form group control element. I'm wondering if we need to add a new form element for info to be displayed beside the label like this, and potentially support for what that would look like in a horizontal form layout. wdyt?
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.
This looks god to me now from a design perspective. Thanks @srambach !
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.
This looks pretty good! My only concern is that I believe this helper text will end up being dynamic so screen reader users will need to be updated with this information the same way that sighted users are. I imagine that it would follow the same pattern as our invalid form example. The only difference that I wonder about is the password strength text.
@jessiehuff do you think that |
569289b
to
6eeba94
Compare
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.
LGTM! Just a couple of small things.
src/patternfly/demos/PasswordStrength/examples/PasswordStrength.md
Outdated
Show resolved
Hide resolved
src/patternfly/demos/PasswordStrength/examples/PasswordStrength.md
Outdated
Show resolved
Hide resolved
src/patternfly/demos/PasswordStrength/examples/PasswordStrength.md
Outdated
Show resolved
Hide resolved
src/patternfly/demos/PasswordStrength/examples/PasswordStrength.md
Outdated
Show resolved
Hide resolved
src/patternfly/demos/PasswordStrength/examples/PasswordStrength.md
Outdated
Show resolved
Hide resolved
src/patternfly/demos/PasswordStrength/examples/PasswordStrength.md
Outdated
Show resolved
Hide resolved
src/patternfly/demos/PasswordStrength/examples/PasswordStrength.md
Outdated
Show resolved
Hide resolved
src/patternfly/demos/PasswordStrength/examples/PasswordStrength.md
Outdated
Show resolved
Hide resolved
…h.md Co-authored-by: Michael Coker <[email protected]>
…h.md Co-authored-by: Michael Coker <[email protected]>
…h.md Co-authored-by: Michael Coker <[email protected]>
…h.md Co-authored-by: Michael Coker <[email protected]>
…h.md Co-authored-by: Michael Coker <[email protected]>
…h.md Co-authored-by: Michael Coker <[email protected]>
…h.md Co-authored-by: Michael Coker <[email protected]>
…h.md Co-authored-by: Michael Coker <[email protected]>
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.
LGTM! Thanks!!
🎉 This PR is included in version 4.121.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Adds an example login page showing interactive password strength using helper text
Fixes #4018