Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

fix(button): Suppress whitespace between icon and text label #2449

Merged
merged 5 commits into from
Mar 26, 2018

Conversation

kfranqueiro
Copy link
Contributor

@kfranqueiro kfranqueiro commented Mar 22, 2018

Opening this for potential discussion. This is a follow-on to #2420 / #2400.

This provides a solution to the problem where whitespace between the icon and text label (which is common since the icon tends to be on its own line in HTML source) causes the spacing between icon and text to be larger than intended by design.

This fixes it by changing button's display property from inline-block to inline-flex. This doesn't have any effects on usage of button in terms of its flow among other external content.

However, it does have one implication for the button's text label content: if the text label includes any child elements, then the entire label needs to be nested in a child element to avoid inline-flex collapsing the space between text nodes and/or child elements. This is illustrated in several updates to demo pages in this PR to keep them consistent with before.

This ultimately comes down to how common/supported we expect the use case of child elements within text labels to be. We could add a caveat note to the readme if we expect users to run across it.

@aprigogin aprigogin self-assigned this Mar 23, 2018
@@ -95,7 +95,7 @@
@include mdc-ripple-radius-bounded;
@include mdc-button-horizontal-padding($mdc-button-horizontal-padding);

display: inline-block;
display: inline-flex;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you might want to change
text-align: center; to justify-content: center;

fill: currentColor;
vertical-align: middle;
align-self: center;
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe align-items: center on button_base?

@codecov-io
Copy link

codecov-io commented Mar 26, 2018

Codecov Report

Merging #2449 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2449   +/-   ##
=======================================
  Coverage   98.91%   98.91%           
=======================================
  Files         104      104           
  Lines        4234     4234           
  Branches      534      534           
=======================================
  Hits         4188     4188           
  Misses         46       46

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b624b0b...61834aa. Read the comment docs.

@kfranqueiro kfranqueiro merged commit f504aa6 into master Mar 26, 2018
@kfranqueiro kfranqueiro deleted the fix/button-icon-label-space branch March 26, 2018 19:14
kfranqueiro pushed a commit that referenced this pull request Apr 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants