Skip to content

fix(translation): let onSurveyInstanceCreated override side-by-side pane setup - #8032

Merged
andrewtelnov merged 1 commit into
masterfrom
fix/translation-renderer-override-in-survey-created
Oct 1, 2026
Merged

andrewtelnov merged 1 commit into
masterfrom
fix/translation-renderer-override-in-survey-created

Conversation

@JaneSjs

@JaneSjs JaneSjs commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Source issue

T27713 - Multi-Language Side-by-Side Comparison View
https://surveyjs.answerdesk.io/internal/ticket/details/T27713

Problem

In the side-by-side Translation tab, the source and target pane surveys are configured (setupSourceSurvey / setupTargetSurvey) after createSurvey returns, i.e. after onSurveyInstanceCreated has already fired. As a result, anything a handler assigns in onSurveyInstanceCreated for the translation-tab:source-survey / translation-tab:target-survey areas (e.g. survey.getRendererForString to plug in a custom inplace string editor such as a rich-text editor) is silently overwritten by the creator.

The designer survey does not have this problem: initializeDesignTimeSurveyModel runs inside createSurvey, before the event. So customers had to defer their assignment (e.g. queueMicrotask) to make it stick in the translation panes.

Fix

Run setupSourceSurvey / setupTargetSurvey inside the createSurvey callback of createInstance, which is invoked before onSurveyInstanceCreated. The methods only configure the passed survey instance (event handlers and callbacks), so moving them earlier does not change their behavior. setupSourceEmptySpaces, buildMappings, etc. still run after both panes are created.

Now onSurveyInstanceCreated is consistently the place where handlers get the last word, for the designer and for the translation panes:

creator.onSurveyInstanceCreated.add((_, options) => {
  if (options.area === "translation-tab:target-survey") {
    options.survey.getRendererForString = (element, name, item) =>
      creator.isStringInplacelyEditable(element, name, item) ? "my-rtf-editor" : undefined;
  }
});

Tests

  • New test: onSurveyInstanceCreated handlers override the string renderers of both panes (fails without the fix).
  • CreatorTester assigns its own getRendererForString in onSurveyInstanceCreated for every survey; it now skips the two translation pane areas so the existing tests keep checking the panes' own renderers.

…ane setup

Co-authored-by: Cursor <cursoragent@cursor.com>
@andrewtelnov
andrewtelnov marked this pull request as draft September 30, 2026 18:40
@andrewtelnov
andrewtelnov marked this pull request as ready for review September 30, 2026 18:40
@andrewtelnov
andrewtelnov merged commit 036ede7 into master Oct 1, 2026
29 checks passed
@andrewtelnov
andrewtelnov deleted the fix/translation-renderer-override-in-survey-created branch October 1, 2026 09:08
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