Skip to content

fix(VE-6459): psuedo-editable height collapse#451

Merged
faraazb merged 2 commits intodevelop_v3from
VE-6459-fix-psuedoeditable-height-collapse
Jul 9, 2025
Merged

fix(VE-6459): psuedo-editable height collapse#451
faraazb merged 2 commits intodevelop_v3from
VE-6459-fix-psuedoeditable-height-collapse

Conversation

@faraazb
Copy link
Copy Markdown
Contributor

@faraazb faraazb commented Jul 7, 2025

The height of the cloned/psuedo-editable element collapses when text-wrap-mode is set to nowrap and text-overflow is set to ellipsis. This change ensures that we override these properties CORRECTLY. Previously we overrode these properties but only in camel case. Now we ensure we perform the camelCase transformation after overriding properties. We also set min-height to whatever the current height of the element is, to prevent height collapse in other scenarios.

The height of the cloned/psuedo-editable element collapses when
text-wrap-mode is set to nowrap and text-overflow is set to ellipsis.
This change ensures that we override these properties CORRECTLY.
Previously we overrode these properties but only in camel case. Now we
ensure we perform the camelCase transformation after overriding
properties. We also set min-height to whatever the current height of the
element is, to prevent height collapse in other scenarios.
@faraazb faraazb requested a review from a team as a code owner July 7, 2025 09:37
@faraazb faraazb changed the title fix: psuedo-editable height collapse fix(VE-6459): psuedo-editable height collapse Jul 7, 2025
Copy link
Copy Markdown
Contributor

@hiteshshetty-dev hiteshshetty-dev left a comment

Choose a reason for hiding this comment

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

Can we please add test cases for these changes?

Comment on lines +25 to +27
if (camelCase) {
styles = getCamelCaseStyles(styles);
}
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.

This will override all the styles if camelCase is true. Is this expected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is expected. I moved this down so we camelCase both exising and overriden fields. However, we are dependent on camelCase implementation in this case, so I have now removed this dependency on the latest commit

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 7, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 72.39% 8613 / 11897
🔵 Statements 72.39% 8613 / 11897
🔵 Functions 71.83% 306 / 426
🔵 Branches 84.79% 1071 / 1263
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/visualBuilder/utils/getPsuedoEditableEssentialStyles.ts 100% 100% 100% 100%
src/visualBuilder/utils/getPsuedoEditableStylesElement.ts 100% 100% 100% 100%
Generated in workflow #444 for commit e8388d0 by the Vitest Coverage Report Action

@faraazb faraazb requested a review from Copilot July 7, 2025 12:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors how pseudo-editable element styles are computed by introducing a dedicated utility for essential overrides and ensuring camel-case transformation occurs after merging. It also adds a min-height override to prevent collapse when measuring height.

  • Extract getPsuedoEditableEssentialStyles to centralize overrides (position, wrapping, overflow, min-height).
  • Move camel-case conversion to after merging essential styles in getPsuedoEditableElementStyles.
  • Update and expand tests to cover merging logic and style key transformations.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/visualBuilder/utils/getPsuedoEditableStylesElement.ts Refactor to merge computed styles with essential overrides via new helper and apply camelCase last
src/visualBuilder/utils/getPsuedoEditableEssentialStyles.ts New helper defining essential style overrides (position, wrapping, overflow, min-height)
src/visualBuilder/utils/test/getPsuedoEditableStylesElement.test.ts Update tests to mock and verify merging and camelCase logic
src/visualBuilder/utils/test/getPsuedoEditableEssentialStyles.test.ts Add tests covering kebab/camel-case outputs and scroll-affected positioning
Comments suppressed due to low confidence (2)

src/visualBuilder/utils/getPsuedoEditableStylesElement.ts:1

  • The term "Psuedo" is consistently misspelled; consider renaming functions, files, and folders from "Psuedo" to "Pseudo" to correct the spelling.
import getCamelCaseStyles from "./getCamelCaseStyles";

src/visualBuilder/utils/test/getPsuedoEditableStylesElement.test.ts:12

  • Add an assertion to verify that getCamelCaseStyles is not called when camelCase is false or undefined, to fully cover the flag’s behavior.
    it("should return merged styles from getStyleOfAnElement and getPsuedoEditableEssentialStyles", () => {

Copy link
Copy Markdown
Contributor

@hiteshshetty-dev hiteshshetty-dev left a comment

Choose a reason for hiding this comment

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

LGTM!!
Have we tested this on compass app?

@faraazb
Copy link
Copy Markdown
Contributor Author

faraazb commented Jul 9, 2025

LGTM!! Have we tested this on compass app?

Tested on Compass with different text elements, works fine. (See video attached in the JIRA ticket.)

@faraazb faraazb merged commit 908ec43 into develop_v3 Jul 9, 2025
10 checks passed
@faraazb faraazb deleted the VE-6459-fix-psuedoeditable-height-collapse branch July 9, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants