Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Take the textHiderTarget width into calculation when hiding the overflowing text.

Dombi Attila0719f4efb2ab
diff --git a/frontend/src/stimulus/controllers/dynamic/attribute.controller.ts b/frontend/src/stimulus/controllers/dynamic/attribute.controller.ts
index 78e12c5a6f3..9ac6a4c151d 100644
--- a/frontend/src/stimulus/controllers/dynamic/attribute.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/attribute.controller.ts
@@ -54,8 +54,14 @@ export default class AttributeController extends Controller {
}
}
+ // When the displayed field contains a macro only, the ellipsis is being shown all the time,
+ // in this case, we should take the textHiderTarget's width into account, otherwise the
+ // text will overflow the ellipsis icon. When a text with the exact size of the column is
+ // displayed, the textHiderTarget is hidden having the offsedWidth 0. This means we will allow
+ // the full width of the column to be used for the text, and not truncate it unnecessarily.
private isEllipssed(e:HTMLElement) {
- return (e.offsetWidth < e.scrollWidth || e.offsetHeight < e.scrollHeight);
+ return (e.offsetWidth - this.textHiderTarget.offsetWidth) < e.scrollWidth
+ || e.offsetHeight < e.scrollHeight;
}
// Sets the background of the text hider element (the one below the expand button) to the background of the reference.