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

padding affects rendered Icon size #2883

Closed
giladgray opened this issue Aug 29, 2018 · 1 comment · Fixed by #2884
Closed

padding affects rendered Icon size #2883

giladgray opened this issue Aug 29, 2018 · 1 comment · Fixed by #2884

Comments

@giladgray
Copy link
Contributor

giladgray commented Aug 29, 2018

Environment

  • Package version(s): core 3.x

Steps to reproduce

  1. render an <Icon>
  2. apply margin and padding to the rendered element.

Actual behavior

<Icon icon="calendar" iconSize={30}>
image

<Icon icon="calendar" iconSize={30} style={{ margin: 10 }} />
image

<Icon icon="calendar" iconSize={30} style={{ padding: 10 }} />
image

Expected behavior

iconSize={30} always produces a 30x30 icon image.

Possible solution

currently <Icon> renders svg.bp3-icon. a refactor to render span.bp3-icon > svg should resolve this, as padding/margin on the span would not affect the svg image inside. then iconSize would clearly dictate the size of the icon and the overall size of the element could be separately specified by CSS.

@giladgray
Copy link
Contributor Author

this is quite similar to what I had to do with Spinner in #2868 to bring back IE support: previously, <Spinner> rendered the <svg> tag as its root but now it renders an HTML element that contains the svg.

seems like <svg> tags are best hidden inside HTML elements for isolation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant