Skip to content

Revisit logic on PropertiesTable IdRow, re: copyability, truncation #3261

Closed

Description

@charliepark

@fakemonster and I are chatting through the PropertiesTable.IdRow component, and he noted a few things:

  1. 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.
  2. 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.
  3. 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.

Activity

  1. david-crespo commented on Jun 24, 2026

    @david-crespo
    Collaborator
    1. Yes!
    2. Ben and I talked about using pretext (or similar logic) to make truncation smarter
    3. I thought we did truncate UUIDs in the middle. We must do it in some places but not others.
  2. charliepark commented on Jun 24, 2026

    @charliepark
    ContributorAuthor

    3. 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.

  3. charliepark commented on Jun 24, 2026

    @charliepark
    ContributorAuthor

    Nice, @benjaminleonard; @fakemonster and I will review that one today.

  4. charliepark commented on Jun 24, 2026

    @charliepark
    ContributorAuthor
    1. 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.

  5. benjaminleonard commented on Jun 24, 2026

    @benjaminleonard
    Contributor

    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.

  6. fakemonster commented on Jun 24, 2026

    @fakemonster
    Contributor

    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

  7. benjaminleonard commented on Jun 30, 2026

    @benjaminleonard
    Contributor

    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.

  8. fakemonster commented on Jun 30, 2026

    @fakemonster
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions