malte-wessel / react-textfit

React component to fit headlines and paragraphs into elements
http://malte-wessel.github.io/react-textfit/
MIT License
474 stars 144 forks source link

Return the clientWidth or clientHeight if getComputedStyle() returns null #34

Closed mckenna closed 3 years ago

mckenna commented 6 years ago

From using this library, we've hit a fairly edge case in Firefox where attempting to call window.getComputedStyle() inside of an iframe which is currently hidden consistently returns null.

You can see the issue logged with Mozilla here: https://bugzilla.mozilla.org/show_bug.cgi?id=548397

Returning the clientHeight or clientWidth fixes my use case in Firefox without adversely affecting any other browser that I've tested in (IE11+, latest Safari, Chrome).

denis-sokolov commented 3 years ago

Thank you!