Skip to content

[DREAM-693] Unify and document ExpandableTextComponent [FOLLOW UP - CSS vars] - #23800

Merged
myabc merged 1 commit into
devfrom
code-maintenance/75274-document-expandable-text-css-var-follow-up
Jun 22, 2026
Merged

[DREAM-693] Unify and document ExpandableTextComponent [FOLLOW UP - CSS vars]#23800
myabc merged 1 commit into
devfrom
code-maintenance/75274-document-expandable-text-css-var-follow-up

Conversation

@myabc

@myabc myabc commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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-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.

Screenshots

no visual changes

What approach did you choose and why?

see #23328 (comment)

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@myabc
myabc requested review from HDinger and Copilot June 17, 2026 17:44
@myabc myabc added needs review maintenance styling javascript Pull requests that update Javascript code labels Jun 17, 2026
@myabc myabc added the ruby Pull requests that update Ruby code label Jun 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-N usage with an inline --op-vertical-truncate-lines style set via join_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.

Comment thread app/components/op_primer/vertical_truncate_component.sass Outdated
Comment thread app/components/op_primer/vertical_truncate_component.rb
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
myabc force-pushed the code-maintenance/75274-document-expandable-text-css-var-follow-up branch from db996fe to 486e14c Compare June 17, 2026 18:30
Base automatically changed from code-maintenance/75274-document-expandable-text to dev June 17, 2026 18:30
@myabc
myabc marked this pull request as ready for review June 17, 2026 18:49
@myabc
myabc merged commit eb73c0c into dev Jun 22, 2026
30 of 32 checks passed
@myabc
myabc deleted the code-maintenance/75274-document-expandable-text-css-var-follow-up branch June 22, 2026 07:40
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

javascript Pull requests that update Javascript code maintenance needs review ruby Pull requests that update Ruby code styling

Development

Successfully merging this pull request may close these issues.

3 participants