victory
victory copied to clipboard
[WIP] fix(#2108) get label text size from dom rendering
Fixes #2108
Uses DOM measurements for label width and height. This method proves to be more accurate and 27% more performant than the existing approximation solution as shown below, particularly for CJK and RTL languages.
Some technical limitations include:
- Lack of support for SSR & React Native
- The
windowelement does not exist for either so we continue to fall back to the approximation solution. - It would be very helpful to get a React Native developer to add a similar solution that will work on mobile.
- The
- Testing is difficult and non-comprehensive
- Since jsdom doesn't actually render and there is no window width/height, it cannot be measured in tests.
- I would love to hear solutions to this problem if any exist. Currently I'm testing that the element is added to the dom.
Feel free to resolve my comments as you wish!