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

Fix alignment of ToggleControl label by removing inherited line-height #18815

Merged
merged 2 commits into from
Dec 2, 2019

Conversation

glendaviesnz
Copy link
Contributor

@glendaviesnz glendaviesnz commented Nov 29, 2019

Description

As noted in #17127, the alignment of the ToggleControl label is incorrect if used used outside of an InspectorControls element. This is due to the component inheriting a different line height from .editor-styles-wrapper. This introduces a minor css change to prevent the toggle element inheriting the line height.

How has this been tested?

Visually tested in browser - see screenshots below.

Screenshots

Before:

toggle2-before

After:

toggle2-after

Multi line label before:

multi-line-before

Multi line label after:

multiline-after

Fixes #17127

@glendaviesnz glendaviesnz changed the title Fix alignment of ToggleControl label by removing line-height inherited from … Fix alignment of ToggleControl label by removing inherited line-height Nov 29, 2019
@youknowriad
Copy link
Contributor

How does it behave with a long label (multiline)?

@glendaviesnz
Copy link
Contributor Author

How does it behave with a long label (multiline)?

Good question, I will give that a try early next week and let you know.

I did also play around with adding a flex align-items, but there were some issues with the bottom margin on the InspectorControls layout with that approach - but if any issues with multiline I will explore the flex alignment options a bit more - the advantage of getting it working with correct flex alignments is it should work properly with any inherited line heights.

@glendaviesnz
Copy link
Contributor Author

glendaviesnz commented Dec 1, 2019

How does it behave with a long label (multiline)?

Turned out that currently the InspectorControls layout was also slightly broken with multiline labels (see new screenshots added above).

Adding a flex align-items as well as removing the line height seems to fix it for both single and multi line labels in both locations

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

LGTM :+1

@youknowriad youknowriad merged commit 50f556f into WordPress:master Dec 2, 2019
@youknowriad youknowriad added this to the Gutenberg 7.1 milestone Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ToggleControl label misalignment when used outside of InspectorControls
2 participants