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

CircularProgressbarWithChildren does not center children #94

Closed
cdosborn opened this issue May 29, 2019 · 4 comments
Closed

CircularProgressbarWithChildren does not center children #94

cdosborn opened this issue May 29, 2019 · 4 comments

Comments

@cdosborn
Copy link

🐛 Bug report

Summary of issue

I was able to correctly center text by setting the svg's root style display: block. I learned that the default display is inline. This causes the svg to have an expanded height that is greater than its set height to account for descenders in text that can appear alongside it. The absolute positioned children would be centered in the expanded height as opposed to the svg's visual height.

@kevinsqi
Copy link
Owner

kevinsqi commented May 30, 2019

hmm, that's unexpected - you shouldn't need to set the svg to have display: block in order to center text. Could you please add the following detail to this issue?

  • What browser version you're on
  • Create a Codesandbox example that reproduces the issue you're having, and take a screenshot of the non-centered text.

@vitorsilvalima
Copy link

it is not being centralised correctly as mention by @cdosborn

Screen Shot 2019-05-31 at 13 46 29

@kevinsqi
Copy link
Owner

kevinsqi commented Jun 2, 2019

Okay, thanks for the screenshot @vitorsilvalima - I think see the issue. My mistake for not noticing it earlier - the reason I didn't see it is because I always include bootstrap 4 CSS in my demo apps, which includes a "reboot" file that contains the following declaration:

svg {
  vertical-align: 'middle';
}

Adding that should fix the centering issue. So to work around the issue temporarily, you could add this style to the root svg element:

<CircularProgressbarWithChildren
  value={20}
  styles={{
    root: {
      verticalAlign: "middle"
    }
  }}
>
  <div>...some children...</div>
</CircularProgressbarWithChildren>

This Codesandbox demonstrates the issue and shows this workaround fix: https://codesandbox.io/s/i086m

I'll also include a proper fix in the next release so you don't have to use this workaround, which I'll try to push out soon.

kevinsqi pushed a commit that referenced this issue Jun 5, 2019
…tering with CircularProgressbarWithChildren (issue #94)
@kevinsqi
Copy link
Owner

kevinsqi commented Jun 5, 2019

This should now be fixed in v2.0.1 - thanks @cdosborn and @vitorsilvalima for reporting the issue! Let me know if you have any further issues.

@kevinsqi kevinsqi closed this as completed Jun 6, 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

No branches or pull requests

3 participants