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

FormToggle styling mis-alignment #13901

Closed
roykho opened this issue Feb 16, 2019 · 5 comments
Closed

FormToggle styling mis-alignment #13901

roykho opened this issue Feb 16, 2019 · 5 comments
Labels
Needs Design Needs design efforts. [Type] Bug An existing feature does not function as intended

Comments

@roykho
Copy link

roykho commented Feb 16, 2019

Describe the bug
The form control is mis-aligned by 2 pixels. See screenshots.

Proposed solution

	.components-form-toggle__on,
	.components-form-toggle__off {
		top: $toggle-border-width * 2; // reduced by 2 px.
	}
	.components-form-toggle__thumb {
		top: $toggle-border-width;  // remove the multiply by 2.
	}

Screenshots
Before the fix.

After applying the fix.

@earnjam earnjam added [Type] Bug An existing feature does not function as intended Needs Design Needs design efforts. labels Feb 18, 2019
@jorgefilipecosta
Copy link
Member

Hi @roykho thank you for reporting this issue 👍 I checked that on the toggles rendered by block editor core (latest posts, paragraph drop cap, archives block) the unalignment problem is not happening.
What were the steps you used to reproduce the issue? Are you able to replicate this problem in a default install without plugins loading styles?

Thank you in advance!

@roykho
Copy link
Author

roykho commented Feb 19, 2019

Hi @jorgefilipecosta so the item I am working on requires some dependencies such as WooCommerce and WooCommerce Bookings however I've checked and I don't believe anything from those are causing the styling issue.

Since opening this, I have then learned to use ToggleControl instead of FormToggle which aligns correctly.

Here is a reference of both form inputs together so you can see the misalignment between the two.

As you can see using ToggleControl is aligned correctly but not FormToggle.

I hope that helps.

@jorgefilipecosta
Copy link
Member

Hi @roykho,
I tried adding the FormToggle component sample code to Gutenberg, and I'm still having troubles replicating this problem:
screenshot 2019-02-25 at 12 55 58
screenshot 2019-02-25 at 12 56 04

I tested the FormToggle inside a BaseControl, and outside one and in both cases the component aligned correctly.

By default, FormToggle does not create labels, in the screenshots provided labels exist, could you provide more information regarding the code you are using with this component? E.g.: the wrapping components, and how the label is being set.

In my tests, if we use top: $toggle-border-width; the component starts rendering incorrectly:
screenshot 2019-02-25 at 13 05 52

Thank you for the help debugging this problem.

@roykho
Copy link
Author

roykho commented Feb 25, 2019

Hi @jorgefilipecosta so the label you see in my first screenshot I added myself since FormToggle doesn't supply a label. But that is not related to the misalignment. You can see in my last screenshot, I added FormToggle without the "self" added label and it is still misaligned. I am not sure if this makes a difference but in my test FormToggle is wrapped inside InspectorControls > PanelBody

If you're still unable to replicate, then I am ok to just close this out and re-open if we get more issues about that and thanks for your help!

@kjellr
Copy link
Contributor

kjellr commented May 2, 2019

I'm unable to reproduce this as well, so I'm going to close for now. If it needs to be opened for any reason, feel free to comment below! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Design Needs design efforts. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants