[DREAM-693] Unify and document ExpandableTextComponent [FOLLOW UP - CSS vars] - #23800
Merged
myabc merged 1 commit intoJun 22, 2026
Merged
Conversation
3 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This follow-up to DREAM-693 changes the vertical (multi-line) truncation implementation to drive -webkit-line-clamp via an inline CSS custom property, avoiding per-line-count modifier classes and enabling arbitrary line counts (with a minimum of 2). It updates component specs and Lookbook documentation/previews accordingly.
Changes:
- Replace
.op-vertical-truncate--lines-Nusage with an inline--op-vertical-truncate-linesstyle set viajoin_style_arguments. - Update vertical truncate styling to use
line-clamp(var(--op-vertical-truncate-lines, 3))and remove the generated modifier-class loop. - Adjust RSpec / frontend Stimulus controller specs and Lookbook docs/previews to assert the new CSS-variable behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
app/components/op_primer/vertical_truncate_component.rb |
Applies line count via inline --op-vertical-truncate-lines and clamps only to a minimum of 2. |
app/components/op_primer/vertical_truncate_component.sass |
Switches line-clamp styling from modifier classes to a CSS variable-based clamp. |
app/components/op_primer/expandable_text_component.rb |
Updates parameter docs to reflect “minimum 2” behavior for multi-line mode. |
spec/components/op_primer/vertical_truncate_component_spec.rb |
Updates expectations to assert the inline CSS variable instead of modifier classes. |
spec/components/op_primer/expandable_text_component_spec.rb |
Updates multi-line truncation assertions to the CSS-variable approach. |
spec/components/op_primer/expandable_text_component_preview_spec.rb |
Updates preview expectations to match the CSS-variable approach. |
lookbook/previews/op_primer/expandable_text_component_preview.rb |
Expands Lookbook control range for lines and keeps previews aligned with variable-based truncation. |
lookbook/docs/components/expandable-text.md.erb |
Updates documentation to describe “2 or more” and CSS variable-driven clamp. |
frontend/src/stimulus/controllers/expandable-text.controller.spec.ts |
Updates fixtures to use --op-vertical-truncate-lines instead of --lines-N classes. |
Replaces the per-count `op-vertical-truncate--lines-N` modifier classes with an inline `--op-vertical-truncate-lines` custom property, set through Primer's `join_style_arguments` like `Primer::Beta::Truncate` does for `max-width`. This drops the generated-class explosion and the hard upper bound, so any count from 2 up works. The floor is 2 because a single clamped line is `single_line`'s job, not `multi_line`'s.
myabc
force-pushed
the
code-maintenance/75274-document-expandable-text-css-var-follow-up
branch
from
June 17, 2026 18:30
db996fe to
486e14c
Compare
Base automatically changed from
code-maintenance/75274-document-expandable-text
to
dev
June 17, 2026 18:30
myabc
marked this pull request as ready for review
June 17, 2026 18:49
HDinger
approved these changes
Jun 22, 2026
myabc
deleted the
code-maintenance/75274-document-expandable-text-css-var-follow-up
branch
June 22, 2026 07:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR is based off #23328. Please merge first.
Ticket
https://community.openproject.org/wp/DREAM-693 (follow up)
What are you trying to accomplish?
Drive ExpandableText line clamp via CSS variable
Replaces the per-count
op-vertical-truncate--lines-Nmodifier classes with an inline--op-vertical-truncate-linescustom property, set through Primer'sjoin_style_argumentslikePrimer::Beta::Truncatedoes formax-width. This drops the generated-class explosion and the hard upper bound, so any count from 2 up works. The floor is 2 because a single clamped line issingle_line's job, notmulti_line's.Screenshots
no visual changes
What approach did you choose and why?
see #23328 (comment)
Merge checklist