Skip to content

develop to stage 6 aug release - #631

Merged
karancs06 merged 9 commits into
stage_v4from
develop_v4
Aug 5, 2026
Merged

develop to stage 6 aug release#631
karancs06 merged 9 commits into
stage_v4from
develop_v4

Conversation

@karancs06

@karancs06 karancs06 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What

Release candidate merge of develop_v4 into stage_v4 for the 6 Aug release. It carries three changes that landed on develop_v4 after v4.4.5.

Tickets: VB-1797, VB-2055

Changes

RTL caret direction while inline editing (VB-1797)

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

  • enableInlineEditing.ts: set dir="auto" on the editable element, so the browser derives writing direction from the content's first strong character.
  • handleIndividualFields.ts: remove the attribute on teardown, next to the existing contenteditable cleanup, so nothing is left behind on the host element.
  • getStyleOfAnElement.ts: exclude direction and unicode-bidi from the styles copied onto the pseudo editable element. Those inline copies were overriding dir="auto" on the truncated/mismatched-content path, so the caret stayed LTR there even after the first fix.

Direction is content-driven, so an empty RTL field starts LTR and switches once the first strong character is typed.

Came in via #620 plus a follow-up commit for the pseudo element path.

isVisualEditorEditing() helper (VB-2055)

Sites whose content updates on its own (CSS animations, carousels, polled or streamed data) kept mutating the DOM while an author was editing, so the quick form resynced to a moving target.

  • src/visualBuilder/utils/editingState.ts: new isVisualEditorEditing(element?). Returns true while element or one of its descendants carries the data-cslp-field-type marker the SDK already sets on the focused field. Omit the argument to check the whole document.
  • src/index.ts: export it from the package entry.

It is a plain check with no observer or subscription, and it returns false when there is no DOM, so SSR is safe. Purely additive: a new named export with no runtime side effects, and it reads an attribute that already existed, so it also works for sites on older SDK versions.

Came in via #629.

goober pragma no longer leaks into the host app

VisualBuilder called goober's setup(h) with Preact's h during init. setup() sets goober's global, shared element pragma, and goober is usually hoisted to a single instance in the host's dependency tree, so this flipped the pragma for every goober consumer on the page. A host app using a goober-backed library such as react-hot-toast then rendered through the Preact pragma and React 19 rejected the elements with "A React Element from an older version of React was rendered", giving a white screen as soon as a toast mounted.

The SDK only uses goober's css, glob, and keyframes, none of which read the pragma, and it never uses styled, the only API that does. Removing the call restores the behavior the SDK had before it was added.

Came in via #630.

Release notes

No version bump in this PR. package.json stays at 4.4.5 on both branches; the bump and CHANGELOG regeneration happen on the stage_v4 to main release PR.

Testing

  • Unit tests for all three changes: new editingState suite (6 cases covering idle, descendant edit, element itself, element scoping, document-wide, SSR), dir="auto" assertions on both the direct and pseudo editable element in enableInlineEditing, and a getStyleOfAnElement case asserting direction and unicode-bidi are not copied.
  • The goober change was verified against a standalone Next.js 15 + React 19 + react-hot-toast app: the crash reproduces before and disappears after, and the goober element brand stays on React 19's Symbol(react.transitional.element) across SDK init. Visual Builder, edit-button, and timeline suites pass, including the hover and overlay tests that style through goober css.
  • RTL editing still needs a manual pass in an RTL locale entry on the canvas build.

🤖 Generated with Claude Code

karancs06 and others added 9 commits July 14, 2026 17:52
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>
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>
fix(VB-1797): match caret direction to text when inline editing
Expose isVisualEditorEditing(element) so a site can pause self-updating
content (CSS animations, carousels, polled/streamed data) while a field is
being edited in Visual Editor. It reads the existing data-cslp-field-type
marker the SDK already sets on the focused element, is side-effect-free, and
returns false during SSR.

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

feat(VB-2055): add isVisualEditorEditing helper
…rash

VisualBuilder called goober's setup(h) with Preact's h at init, which
mutates goober's shared global pragma. A host app that also uses a
goober-backed library such as react-hot-toast then renders through that
pragma, emitting Preact elements into a React 19 tree and crashing with
"A React Element from an older version of React was rendered."

The SDK only uses goober's css/glob/keyframes, none of which read the
pragma, and never uses styled (the sole pragma consumer). setup(h) was
therefore inert for the SDK and only leaked into the host. Removing it
restores the pragma-free behavior the SDK shipped with before the call
was introduced.

Co-Authored-By: Claude <noreply@anthropic.com>
…react19-crash

fix: isolate goober pragma from host app to prevent react-hot-toast crash
@karancs06
karancs06 requested a review from a team as a code owner August 5, 2026 10:40
@snyk-io

snyk-io Bot commented Aug 5, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 67.35% 2523 / 3746
🔵 Statements 66.23% 2564 / 3871
🔵 Functions 64.56% 450 / 697
🔵 Branches 61.96% 1533 / 2474
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/index.ts 100% 100% 100% 100%
src/visualBuilder/index.ts 53.03% 26.76% 31.25% 53.03% 111-114, 119-128, 134-204, 212-245, 255-276, 330-332, 336, 390-393, 101-107
src/visualBuilder/utils/editingState.ts 100% 100% 100% 100%
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 #877 for commit c173ba7 by the Vitest Coverage Report Action

@hitesh-shetty-cstk hitesh-shetty-cstk 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 84c7c9b into stage_v4 Aug 5, 2026
8 of 9 checks passed
@karancs06
karancs06 deleted the develop_v4 branch August 5, 2026 10:51
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