Skip to content

Bug: [@pierre/trees] file names show stray ellipsis/truncation artifacts at certain browser zoom levels #816

Description

@Alek99

Prerequisites

Describe the issue

In FileTreeView, row names are rendered through MiddleTruncate, and the truncation/ellipsis rendering breaks at non-100% browser zoom levels. At certain zoom steps the names render with spurious ellipses ("…") in the middle even when there's enough room to show the full name. The filetree sidebar behaves differently from the previous implementation, and the issue is more noticeable on wide/large monitors.
The artifacts appear to be tied to sub-pixel rounding at fractional device-pixel ratios produced by zooming:

Chrome: Fine at 100% and one step out. Zooming two levels in or two levels out triggers the artifacts.
Safari: Only reproduces at two zoom levels in.

Reproduction

Open https://trees.software/ (also reproduces in any app embedding the filetree sidebar).
In Chrome, zoom out two levels (Cmd/Ctrl + "-" twice) from 100%, or zoom in two levels.
Observe filenames in the tree rendering with ellipses / collapsed characters where the full name should fit.

Reproduces most readily on a wide monitor.

What browser(s) are you seeing the problem on?

Safari, Chrome

What version of @pierre/diffs are you using?

1.0.0-beta.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtrees

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions