You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Revisit logic on PropertiesTable IdRow, re: copyability, truncation #3261
@fakemonster and I are chatting through the PropertiesTable.IdRow component, and he noted a few things:
Because of our using the Truncate component within it — the copy-to-clipboard button doesn't show up if the cell text isn't truncated, we only get the copy-to-clipboard affordance some of the time. It might be worth refactoring so that if hasCopyButton is true, the button shows up regardless of the truncation rules.
UUIDs are 36 characters (4 hyphens + 32 characters) and our default truncation length on the IdRow component is 32 characters, which means we lose 4 characters (and possibly more) no matter what, and if the cell is long enough, we should just be able to see the whole thing. So either we could show the whole thing, or show significantly fewer characters; as it is, it looks messy.
We might consider defaulting the UUID truncation, when applied, to the middle of the string, so users can visually compare either "first N" or "last N" characters, rather than just having the last characters chopped off.
I thought we did truncate UUIDs in the middle. We must do it in some places but not others.
The default property for <Truncate is 'end', and we aren't currently overriding that prop when calling it in IdRow, but that's an easy change.
Turns out if we move it to middle and the cell is narrow because of responsive / real estate issues, we end up with both the TS function's middle ellipsis and the CSS "truncate" class's end ellipsis, and it doesn't look great. Will punt on that particular problem to see if Ben's pretext solution resolves that.
I guess we'd remove the CSS truncate completely. We need length awareness to conditionally show the copy button and tooltip and the current approach doesn't work well because it's not monospaced.
irt pretext: are there cases where we're truncating multiline text? for just the case of truncating single-line, i think you can get awfully far with pure CSS, and then measuring to detect truncation to decide whether the tooltip needs to be available. from a practical perspective you'd probably want to render the copy button all the time, then, but that seems preferable to me
Is it possible to do middle truncation with CSS without some hacky span splitting? And we can't render the raw version in a tooltip only if truncated with pure CSS.
Is it possible to do middle truncation with CSS without some hacky span splitting?
No, but I'm not sure it's all that hacky. It just requires specifying the # of characters you want on the end.
And we can't render the raw version in a tooltip only if truncated with pure CSS.
This we can do, it's basically the code in your linked PR: in JS, measure if the scrollWidth differs from the clientWidth, if yes, then we know it's truncated and can decide to render the tooltip.
Activity
david-crespo commentedon Jun 24, 2026
benjaminleonard commentedon Jun 24, 2026
Sounds good, take a look at the pretext-esque measuring here: https://github.com/oxidecomputer/console/pull/3182/changes#diff-d74a9f301c3947750d6e2e9959215c69410591c9ab54a8f179bc9ec395ad5fa2R27-R38
charliepark commentedon Jun 24, 2026
The default property for
<Truncateis'end', and we aren't currently overriding that prop when calling it inIdRow, but that's an easy change.charliepark commentedon Jun 24, 2026
Nice, @benjaminleonard; @fakemonster and I will review that one today.
charliepark commentedon Jun 24, 2026
Turns out if we move it to
middleand the cell is narrow because of responsive / real estate issues, we end up with both the TS function's middle ellipsis and the CSS"truncate"class's end ellipsis, and it doesn't look great. Will punt on that particular problem to see if Ben's pretext solution resolves that.benjaminleonard commentedon Jun 24, 2026
I guess we'd remove the CSS truncate completely. We need length awareness to conditionally show the copy button and tooltip and the current approach doesn't work well because it's not monospaced.
The measure test function is very quick.
fakemonster commentedon Jun 24, 2026
irt pretext: are there cases where we're truncating multiline text? for just the case of truncating single-line, i think you can get awfully far with pure CSS, and then measuring to detect truncation to decide whether the tooltip needs to be available. from a practical perspective you'd probably want to render the copy button all the time, then, but that seems preferable to me
benjaminleonard commentedon Jun 30, 2026
Is it possible to do middle truncation with CSS without some hacky span splitting? And we can't render the raw version in a tooltip only if truncated with pure CSS.
fakemonster commentedon Jun 30, 2026
No, but I'm not sure it's all that hacky. It just requires specifying the # of characters you want on the end.
This we can do, it's basically the code in your linked PR: in JS, measure if the scrollWidth differs from the clientWidth, if yes, then we know it's truncated and can decide to render the tooltip.