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

IconButton has unbalanced vertical alignment. #696

Closed
Reanmachine opened this issue Aug 9, 2016 · 0 comments
Closed

IconButton has unbalanced vertical alignment. #696

Reanmachine opened this issue Aug 9, 2016 · 0 comments

Comments

@Reanmachine
Copy link
Contributor

When using the <IconButton> with the material design font icons the inner <span> element that displays the material icon does not align properly.

I've confirmed that it's not being acted upon by any outside styles and reproduced the example in the playground on the docs site.

Here is an illustration of the problem:

Alignment Problem

As you can see the icon isn't aligned with the text next to it, I've even "lit" the background to illustrate that the button itself is centered properly but the icon inside the button is pushed down (look close, you can see the highlighted overlay showing it's off by a few pixels.

Adding vertical-align: top to the <span> seems to fix the problem as shown here:

Fixed

However I'm not sure why, and it doesn't seem semantically like the correct fix.

Here's the example in the playground:

const ButtonsTest = () => (
  <div>
  <div style={{'margin-bottom': '5px', 'border': '1px solid red', height: '38px'}}>
    <IconButton style={{'background-color': 'blue'}} icon='favorite' accent />
    <span>This is some text!</span>
  </div>
  <div style={{'border': '1px solid red', height: '38px'}}>
    <IconButton icon='favorite' accent />
    <span>This is some text!</span>
  </div>
  </div>
);

return <ButtonsTest />
javivelasco added a commit that referenced this issue Aug 22, 2016
…lignment

Fixed #696 - Button Icon/Inner Alignment
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

No branches or pull requests

1 participant