Content
View differences
Updated by Alexander Coles 8 days ago
Two independent implementations handle truncated/expandable text using Primer's Primer's `HiddenTextExpander`:
1. **Inline expansion** — `OpPrimer::ExpandableTextComponent` + Stimulus `TruncationController`
*
- Horizontal truncation (CSS ellipsis via `Primer::Beta::Truncate`)
*
- Text expands/collapses in place
*
- Used on: [Permissions Report](https://qa.openproject-edge.com/admin/roles/report), [Workflows](https://qa.openproject-edge.com/workflows/7/edit)
2. **Dialog expansion** — `OpenProject::Common::AttributeComponent` + Stimulus `AttributeController`
*
- Vertical truncation (`max-height` + `overflow: hidden`)
*
- Opens a `Primer::Alpha::Dialog` with full text
*
- Used for Project Attributes
These share the same core problem — detect truncation, show an expander — but differ on two orthogonal axes:
*
- **Truncation direction:** horizontal (single-line) vs vertical (multi-line via `line-clamp`)
*
- **Expansion mode:** inline (toggle in place) vs dialog (open modal)
### Scope
1. **Unify Stimulus controllers** — fold `AttributeController` into `TruncationController` with `mode` (horizontal/vertical) and `inline` (true/false) values
2. **Extend** `**ExpandableTextComponent**` **Extend `ExpandableTextComponent`** — support all four combinations of truncation direction × expansion mode
3. **Refactor** `**AttributeComponent**` **Refactor `AttributeComponent`** — compose `ExpandableTextComponent` instead of managing truncation markup directly
4. **Document in Lookbook** — previews for all modes + docs page
### Open question for reviewers
The old `AttributeController` had a "text hider" "text hider" overlay that masked truncated content behind a solid background (needed because the expand button was absolutely positioned over the text). With the new flex layout and `line-clamp`, this overlay should be unnecessary. Flagged for review.
### Screenshots
#### Example 1 (Permissions Report — horizontal inline)
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/921290/content"><img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/921291/content">
#### Example 2 (Project Attributes — vertical dialog)
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/921293/content"><img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/921292/content">
### Related
* - #75275 — extracted `ExpandableTextComponent` and fixed ellipsis alignment (merged)
### Hints for QA
* **Smoke test the Lookbook pages** (ensure they render, no need to check content in-depth)
* Pages > Components > Expandable Text `/lookbook/pages/components/expandable_text`
* Previews > OpenProject > Primer > Expandable Text `/lookbook/inspect/OpenProject/Primer/expandable_text/default`
* Check the application pages listed under "Used in" in the Lookbook (includes pages recently touched in [DREAM-694](https://community.openproject.org/work_packages/DREAM-694))
* Check long text project attributes render correctly in various places: when added as a column in Projects table, or shown in the sidebar on the Project Overview page.
<br>
1. **Inline expansion** — `OpPrimer::ExpandableTextComponent` + Stimulus `TruncationController`
*
-
*
-
*
-
*
-
*
-
*
-
*
-
*
-
1. **Unify Stimulus controllers** — fold `AttributeController` into `TruncationController` with `mode` (horizontal/vertical) and `inline` (true/false) values
The old `AttributeController` had a "text hider"
### Screenshots
#### Example 1 (Permissions Report — horizontal inline)
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/921290/content"><img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/921291/content">
#### Example 2 (Project Attributes — vertical dialog)
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/921293/content"><img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/921292/content">
### Related
*
### Hints for QA
* **Smoke test the Lookbook pages** (ensure they render, no need to check content in-depth)
* Pages > Components > Expandable Text `/lookbook/pages/components/expandable_text`
* Previews > OpenProject > Primer > Expandable Text `/lookbook/inspect/OpenProject/Primer/expandable_text/default`
* Check the application pages listed under "Used in" in the Lookbook (includes pages recently touched in [DREAM-694](https://community.openproject.org/work_packages/DREAM-694))
* Check long text project attributes render correctly in various places: when added as a column in Projects table, or shown in the sidebar on the Project Overview page.
<br>