Closed TomerAberbach closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
react-wrap-balancer | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 1, 2023 2:47am |
Some reproductions of the issue: https://codesandbox.io/s/react-wrap-balancer-bug-ubbizi
The problem is that if the text can't wrap, the container's height will never change as we shrink the wrapper. So we keep shrinking the wrapper, never observe a height change, and end up with a width lower than the minimum required to not overflow the container.
I solved it by making sure
lower
is no less than the minimum width necessary to fit the contents (seescrollWidth
documentation).Ideally you wouldn't give
react-wrap-balancer
text that can't wrap in the first place, but sometimes you're getting arbitrary titles from somewhere and you don't know if they are single words or have non-breaking spaces so we should probably handle this case in the package.