Repository navigation
Description
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
- Render
ResourceNamewithtruncate-name="false"inside a narrow container (about 180px). - Pass a file name without spaces or hyphens, e.g.
PXL_20260703_163401420.jpg. - 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.
- In
packages/web-pkg/src/components/FilesList/ResourceName.vue, replacebreak-normalon the basename withwrap-anywhere(overflow-wrap: anywhere). This restores the behavior of the oldoc-text-breakclass.wrap-anywhereis preferred overwrap-break-wordbecause it also affects the min-content size, so the span shrinks correctly inside the flex container of the component without furthermin-w-0tweaks. It is already used elsewhere in the design system (OcModal). - 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).
- Remove the
[&_span]:break-alloverride 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. - 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
- Keep the file extension attached to a wrapping resource name #4017 keeps the extension attached to a wrapping basename
- fix(preview): truncate long file names in the photo roll #4018 switches the preview app photo roll back to truncation, so it no longer depends on the wrapping mode
- 4c4ffa3 replaced
oc-text-breakwithbreak-normal - feat: move favorite resource indicator to resource name #2261 added the
break-allworkaround in the photo roll
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity