Skip to content

Resource name does not wrap long names when truncation is disabled #4019

Closed

Description

@dschmidt

Initial Checklist

  • I understand this is a bug report and questions should be posted in the Community Discussions
  • I searched issues and couldn't find anything (or linked relevant results below)

Bug Description

ResourceName (web-pkg) has two rendering modes. With truncate-name (the default) the name is cut to one line with an ellipsis. With truncate-name="false" the name is supposed to wrap.

The non-truncating mode has not wrapped since the Tailwind migration in 4c4ffa3. The old oc-text-break class (overflow-wrap: break-word) was replaced with break-normal, which is not equivalent: break-normal sets overflow-wrap: normal, so a long name without break opportunities (camera file names, hashes, URLs) simply overflows its container.

Consumers worked around this from the outside. The preview app photo roll forced [&_span]:break-all onto every span inside the component (introduced in #2261). That also hit the extension span and caused the extension to float next to a wrapped basename, see #4017 for the layout side of that.

Both the missing wrapping and the fact that consumers have to patch internal spans point to the same root cause: the non-truncating mode of ResourceName does not handle long names on its own.

Reproduction Steps

  1. Render ResourceName with truncate-name="false" inside a narrow container (about 180px).
  2. Pass a file name without spaces or hyphens, e.g. PXL_20260703_163401420.jpg.
  3. Observe the name.

Expected Outcome

The basename wraps inside the container when it does not fit, breaking only where needed (overflow-wrap). The extension follows the basename inline. Consumers do not need to override the component's internal classes.

Actual Outcome

The basename does not wrap and overflows the container. To get any wrapping, consumers have to force break-all onto the component's inner spans, which produces arbitrary breaks and detaches the extension from the name.

Proposed Fix

Make the non-truncating mode of ResourceName self-sufficient so consumers never have to override its inner spans.

  1. In packages/web-pkg/src/components/FilesList/ResourceName.vue, replace break-normal on the basename with wrap-anywhere (overflow-wrap: anywhere). This restores the behavior of the old oc-text-break class. wrap-anywhere is preferred over wrap-break-word because it also affects the min-content size, so the span shrinks correctly inside the flex container of the component without further min-w-0 tweaks. It is already used elsewhere in the design system (OcModal).
  2. Keep basename and extension in a single wrapping span in that mode, so the extension follows the basename inline (Keep the file extension attached to a wrapping resource name #4017).
  3. Remove the [&_span]:break-all override from consumers. The only one today is the preview app photo roll, which fix(preview): truncate long file names in the photo roll #4018 switches back to truncation anyway.
  4. Add a unit test that renders a long name without break opportunities with truncate-name="false" and asserts the basename carries the wrapping class and the extension is inside the same wrapper as the basename.

With #4017 and #4018 merged, the remaining change is step 1 and step 4.

Related

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions