Closed jimmynotjim closed 10 months ago
Latest commit: 957adcb3997a439cb0f504b0c7d58f110f85be94
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Hey Jim, thanks for the PR.
I was looking at adding a test and what stood out to me when reviewing your demo was the merging of layout related styles and the capsize styles on the same element. This is not recommended, as the capsize styles will be forever competing with a growing list of possible collisions.
Instead, I would recommend using nested elements:
<table style="border-collapse: collapse;">
<tr>
<td>
<div class="capsizeStyle">
<span style="display: block; white-space: break-spaces;">Table cell</span>
</div>
</td>
</tr>
</table>
This is the approach we take for text truncation. We address this in the FAQs under "What is the recommended way to handle text overflow/truncation?", but not in the readme. I'll look to add something in there too.
Apologies for not progressing this discussion sooner, let me know your thoughts.
Added a note under the createStyleObject
docs to capture this advice.
If required we can continue this discussion, but i'll close the PR for now.
When text managed by Cap Size is contained within a
table
element and haswhite-space
set asbreak-line
,pre
, orpre-wrap
the:before
and:after
pseudo elements pick up excess spacing due to beingdisplay: table
. This fix resets thewhite-space
value of the pseudo elements to remove the excess spacing.Open this demo in Firefox to view the bug and fix https://stackblitz.com/edit/vitejs-vite-dwmuts?file=src%2FApp.css.ts,src%2FApp.tsx