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
When use some fonts autoresize changes height after type #365
Comments
I'm assuming that your web-font hasn't finished loading by the time Autosize is applied, and that the web-font (Roboto) dimensions are slightly different than the placeholder the browser used. You'll need to call If you just wanted to support bleeding edge, I think you could do this:
|
@jackmoore no, it's downloaded< I've check it first. |
I don't think you understood my comments. |
I understand your answer clearly, but I don't want to spend hours testing how this font readiness detection will work in dozens of browsers. Maybe it's better to load fonts without |
Damn. Even after I add THis is probably another question, but how do I delegate font-loading to |
Autosize doesn't have anything to do with what fonts are loaded. |
You right, this one is working in Chrome document.fonts.ready.then(() => {
autosize.update(this.$refs.textarea)
}) But now I have noticeable resizing of textarea when page loads 😄 |
While the font is loading the browser will first paint the document with a placeholder of how large it things the font will be based on the font-size. If Autosize runs during this time, it's going to be a little off once the real font loads, because the real font is going to have slightly different size and spacing to it than the placeholder. This is unavoidable for Autosize because there just isn't enough information for it to do an exact size, it has to use what the browser painted to the DOM. So you would either want to wait until the font is loaded to assign autosize, or go ahead and assign autosize and then call It's an unfortunate situation, I'm surprised it took so long for this to become a ticket. I hadn't really had to think about it until now. It's a valid issue, I have to decide what Autosize's responsibility should be in this situation. I will have to explore adding automatic resizing on font-load, since that is a detectible event. |
Hello. I noticed that if I use some fonts (for example Roboto) then
autoresize
adjust height of input when I begin to type. Before I type (on page load) it sets height at 45px, for example, after I begin type it set to 47px.What can cause this weird behavior and how to fix it?
The text was updated successfully, but these errors were encountered: