develop to stage 6 aug release - #631
Merged
Merged
Conversation
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
Release v4.4.5
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
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Release candidate merge of
develop_v4intostage_v4for the 6 Aug release. It carries three changes that landed ondevelop_v4after 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: setdir="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 existingcontenteditablecleanup, so nothing is left behind on the host element.getStyleOfAnElement.ts: excludedirectionandunicode-bidifrom the styles copied onto the pseudo editable element. Those inline copies were overridingdir="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: newisVisualEditorEditing(element?). Returnstruewhileelementor one of its descendants carries thedata-cslp-field-typemarker 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
falsewhen 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
VisualBuildercalled goober'ssetup(h)with Preact'shduring 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 asreact-hot-toastthen 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, andkeyframes, none of which read the pragma, and it never usesstyled, 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.jsonstays at 4.4.5 on both branches; the bump and CHANGELOG regeneration happen on thestage_v4tomainrelease PR.Testing
editingStatesuite (6 cases covering idle, descendant edit, element itself, element scoping, document-wide, SSR),dir="auto"assertions on both the direct and pseudo editable element inenableInlineEditing, and agetStyleOfAnElementcase assertingdirectionandunicode-bidiare not copied.Symbol(react.transitional.element)across SDK init. Visual Builder, edit-button, and timeline suites pass, including the hover and overlay tests that style through goobercss.🤖 Generated with Claude Code