fitty icon indicating copy to clipboard operation
fitty copied to clipboard

Fitty calculate font-size will cause text to be ellipsed when using `text-overflow: ellipsis`

Open tkforce opened this issue 3 years ago • 3 comments

Current behavior

When applying overflow:hidden and text-overflow: ellipsis to the fitty element while setting the max-width of the fitty element to be the exact width of it's parent, the css ellipsis will kick in.

Expected behavior

Ideally when the max-width of the fitty element is the same as it's parent's width, the calculated font-size should not be causing ellipsis to work.

Demo

https://codesandbox.io/s/fitty-demo-forked-6ojp3z

Any kind of help is appreciated and thanks again for making this awesome tool 🎉

tkforce avatar Jun 30 '22 03:06 tkforce

true, I think it would be best to set text-overflow to its default value on elements that are used with Fitty

rikschennink avatar Jun 30 '22 05:06 rikschennink

I see your point, but what we're trying to achieve is to have a min font-size on the Fitty text, and when the font-size can't get any smaller (say 8px), the truncation will kick in and ellipsis the part that is out of the container.

But it seems that text-overflow: ellipsis; will causes the ellipsis to kick in even when it doesn't seems to be needed (when the last character is very close to the edge?) https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow

tkforce avatar Jul 04 '22 01:07 tkforce

I'll leave this issue open then.

rikschennink avatar Jul 04 '22 06:07 rikschennink