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

Components: ToggleControl text overflows when it has a long label #45962

Merged
merged 5 commits into from
Nov 29, 2022
Merged

Components: ToggleControl text overflows when it has a long label #45962

merged 5 commits into from
Nov 29, 2022

Conversation

devanshijoshi9
Copy link
Contributor

What?

  • Add css properties that resolve the toggle labelled text-overflow.

Why?

ToggleControl text overflows when it has a long label.
As the label gets longer, the text overshadows the toggle button.

How?

  • Added new style.scss file in ToggleControl component to add CSS properties.

Testing Instructions

Screenshots or screencast

togglecontrol-component

@codesandbox
Copy link

codesandbox bot commented Nov 22, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Nov 22, 2022
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @devanshijoshi9! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

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.

Thank you for contributing! 😃

The solution in this PR is absolutely correct, but it turns out there is also a component called FlexBlock that is exactly for this purpose (impossible to discover, sorry!). Since ToggleControl is stylesheet-free at the moment, it might be cleaner to use that component instead of adding a new stylesheet just for this.

So basically like (here):

				<FlexBlock
					as="label"
					htmlFor={ id }
					className="components-toggle-control__label"
				>
					{ label }
				</FlexBlock>

What do you think?


And it would be great if you could add a quick changelog before merging, thanks!

@mirka
Copy link
Member

mirka commented Nov 25, 2022

Great, thank you! You can go ahead and run npm run test:unit:update to update the snapshot tests, and we're good to go 👍

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.

Perfect, thanks again for contributing! 🚀

@mirka mirka merged commit 2b8a42d into WordPress:trunk Nov 29, 2022
@github-actions
Copy link

Congratulations on your first merged pull request, @devanshijoshi9! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 14.7 milestone Nov 29, 2022
@devanshijoshi9
Copy link
Contributor Author

devanshijoshi9 commented Nov 30, 2022

Thanks, @mirka for your time and guidance 🙂

I have linked my GitHub account with my wordpress.org account and I am able to see this contribution in my activity section. Thanks a lot for the credit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Components: ToggleControl text overflows when it has a long label
3 participants