Skip to content

fix(VB-1797): match caret direction to text when inline editing#620

Merged
karancs06 merged 2 commits into
develop_v4from
VB-1797-rtl-caret-direction
Jul 17, 2026
Merged

fix(VB-1797): match caret direction to text when inline editing#620
karancs06 merged 2 commits into
develop_v4from
VB-1797-rtl-caret-direction

Conversation

@karancs06

@karancs06 karancs06 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What

Inline-editable text fields kept a left-to-right caret even when the field held right-to-left content (Arabic, Hebrew). The glyphs rendered in the correct RTL order, but the caret stayed on the LTR side and did not follow where characters were being inserted, so editing RTL text was awkward.

Change

  • Set dir="auto" on the editable element when inline editing turns on. The browser then picks the writing direction from the content's first strong character, so the caret matches the text.
  • Remove the attribute on teardown, next to the existing contenteditable cleanup, so nothing is left on the host element.

Notes

  • Direction is content-driven. An empty RTL field starts LTR until the first strong character is typed, then switches.
  • Added a unit test that checks the attribute is set on an editable field.

Testing

  • npx vitest run for the affected utils passes.
  • Still needs a manual check in an RTL locale entry once this build is picked up by the canvas.

Jira: VB-1797

Inline-editable fields kept an LTR caret even when the content was
right-to-left, so the caret ignored where RTL text (Arabic, Hebrew) was
being inserted. Set dir="auto" on the editable element so the browser
derives writing direction from the content, and clear it on teardown.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@karancs06
karancs06 requested review from a team as code owners July 14, 2026 12:23
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 67.31% 2519 / 3742
🔵 Statements 66.17% 2557 / 3864
🔵 Functions 64.51% 449 / 696
🔵 Branches 61.79% 1522 / 2463
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/visualBuilder/utils/enableInlineEditing.ts 100% 100% 100% 100%
src/visualBuilder/utils/getStyleOfAnElement.ts 100% 100% 100% 100%
src/visualBuilder/utils/handleIndividualFields.ts 97.14% 77.77% 100% 97.14% 99
Generated in workflow #859 for commit a06ad34 by the Vitest Coverage Report Action

Comment thread src/visualBuilder/utils/enableInlineEditing.ts
Comment thread src/visualBuilder/utils/__test__/enableInlineEditing.test.ts
The pseudo element used for truncated/mismatched fields copies the
source element's computed direction/unicode-bidi inline, which overrode
dir="auto" and left an LTR caret on RTL content. Exclude both from the
copied styles so the attribute governs direction on that path too.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

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

LGTM

@karancs06
karancs06 merged commit 970e956 into develop_v4 Jul 17, 2026
9 checks passed
@karancs06
karancs06 deleted the VB-1797-rtl-caret-direction branch July 17, 2026 05:17
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.

2 participants