Skip to content
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

InputControl: added password visibility story #60898

Merged
merged 6 commits into from
Apr 23, 2024

Conversation

DaniGuardiola
Copy link
Contributor

@DaniGuardiola DaniGuardiola commented Apr 19, 2024

What?

Fixes #60502

Add a story with an example of a "password input visibility toggle" pattern, as suggested in linked issue.

Why?

To provide users with an example of how to implement this pattern.

How?

Adding a story.

Testing Instructions

See InputControl > Show Password story on Storybook.

Testing Instructions for Keyboard

Tab around to focus the input or the button.

Screenshots or screencast

Kapture.2024-04-19.at.14.19.09.mp4

@DaniGuardiola DaniGuardiola marked this pull request as ready for review April 19, 2024 12:20
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: DaniGuardiola <daniguardiola@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@mirka mirka self-requested a review April 19, 2024 13:06
@mirka mirka added [Type] Developer Documentation Documentation for developers [Package] Components /packages/components Storybook Storybook and its stories for components labels Apr 19, 2024
<Tooltip
text={ visible ? 'Hide password' : 'Show password' }
>
<Button
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to use the size="small" variant so the focus rings don't overlap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

Copy link
Contributor Author

@DaniGuardiola DaniGuardiola Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what's the right way to style things in this context, so I went with inline styles to vertically center it. I also originally went with flex + align items center, but then realized flex was enough (not sure why though). Any suggestions welcome!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's just the fact the Button became display: block because of the flex parent. Which is equivalent to setting line-height: 0.

An inline style is perfectly appropriate here 👍

@mirka
Copy link
Member

mirka commented Apr 22, 2024

Just FYI because this happens a lot: After there is a new release of the wp-components package on trunk, any open PRs with changelog modifications that haven't been manually reconciled with trunk can get placed under the wrong release section upon landing, due limitations of the automatic text merging. 7e0f0ea

Let me know if you have any ideas how to prevent that from happening 😅 For now we have to keep an eye out for releases (about twice monthly), and reconcile manually.

Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

@mirka mirka merged commit c627fac into WordPress:trunk Apr 23, 2024
60 checks passed
@github-actions github-actions bot added this to the Gutenberg 18.3 milestone Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components Storybook Storybook and its stories for components [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TextControl: Add 'show password' toggle to password input
2 participants