You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2026/06/03 08:15:13 UTC
Re: [PR] fix(list-view-card): truncate long descriptions and surface full text… [superset]
Copilot commented on code in PR #40500:
URL: https://github.com/apache/superset/pull/40500#discussion_r3346918674
##########
superset-frontend/packages/superset-ui-core/src/components/ListViewCard/index.tsx:
##########
@@ -259,7 +268,15 @@ function ListViewCard({
</div>
</TitleContainer>
}
- description={description}
+ description={
+ description ? (
+ <Tooltip title={description}>
+ <span>{description}</span>
+ </Tooltip>
+ ) : (
+ description
+ )
+ }
Review Comment:
The conditional `description ? (...) : description` is harder to reason about because it relies on truthiness and returns the same expression in the `else` branch. Consider using an explicit nullish check (or a string-length check if the intent is only to tooltip non-empty strings) to avoid surprising behavior for empty strings and to simplify the control flow.
##########
superset-frontend/packages/superset-ui-core/src/components/ListViewCard/index.tsx:
##########
@@ -259,7 +268,15 @@ function ListViewCard({
</div>
</TitleContainer>
}
- description={description}
+ description={
+ description ? (
+ <Tooltip title={description}>
+ <span>{description}</span>
+ </Tooltip>
+ ) : (
+ description
+ )
+ }
Review Comment:
The tooltip content is only reliably accessible via hover because the child is a non-focusable `span`. To make the full description accessible to keyboard users, make the trigger element focusable (e.g., add `tabIndex={0}`) and ensure the tooltip also opens on focus (depending on Tooltip defaults in your Ant version).
##########
superset-frontend/packages/superset-ui-core/src/components/ListViewCard/index.tsx:
##########
@@ -49,6 +49,15 @@ const StyledCard = styled(Card)`
transform: translateY(0);
}
}
+
+ /* Truncate long descriptions (e.g. localized "Modified at" timestamps)
+ so they don't overflow the card. The full value remains accessible
+ via the tooltip wrapper applied around the description. */
+ .ant-card-meta-description {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
Review Comment:
This forces *all* descriptions in this card to a single line (`white-space: nowrap`), which is a behavior change for any descriptions that were previously intended to wrap over multiple lines. If only certain fields (like timestamps) need truncation, consider scoping the truncation to a dedicated wrapper/class for those fields, or use a multi-line clamp approach so descriptions can still wrap (while preventing overflow).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org