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

Utils.measureTextWidth should add span to relevant container not body - measurements are off #316

Closed
paulpooch opened this issue Dec 6, 2016 · 5 comments

Comments

@paulpooch
Copy link
Contributor

paulpooch commented Dec 6, 2016

My root has font-size of 100px.

My div holding the <Blueprint.DatePicker> has font-size: 16px.

DatePicker tries to measure the width of the month labels by adding 's to the body - as a result the measurements are wrong. I'd suggest the 's get appended to the component container and NOT document.body.

This would stop differing font-sizes from screwing things up.

@adidahiya
Copy link
Contributor

yeah, that makes sense @paulpooch. we could change the function signature to

export function measureTextWidth(text: string, className = "", containerElement = document.body) {
    ...
}

@paulpooch
Copy link
Contributor Author

Sounds good. My issue was in datePickerCaption.positionArrows()

It was measuring totally wrong and my arrows were like halfway across the page : )

Could you slap a ref on on the root div of datePickerCaption and measure relative to that element? I can make a PR if you want I don't know TS yet.

@giladgray
Copy link
Contributor

giladgray commented Dec 6, 2016

@paulpooch if you're interested in learning some TS then go ahead and make a PR! 🎩 we'll help you through any tricky bits. otherwise the team will pick this up early next year.

@cmslewis
Copy link
Contributor

cmslewis commented Dec 6, 2016

@paulpooch I had some time to open a PR for this today. Feel free to peruse #320 and see if it makes sense and addresses things correctly. Would appreciate your thoughts here. 👍

@cmslewis cmslewis modified the milestones: 1.4.0, 1.3.0 Dec 6, 2016
@cmslewis cmslewis self-assigned this Dec 6, 2016
@paulpooch
Copy link
Contributor Author

paulpooch commented Dec 7, 2016 via email

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

No branches or pull requests

5 participants