surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.2k stars 809 forks source link

A question that should be both made visible and enabled by the trigger, appears with `sd-element__title--disabled` css class the second time #6048

Closed d3n13 closed 1 year ago

d3n13 commented 1 year ago

Are you requesting a feature, reporting a bug or ask a question?

Reporting a bug

What is the current behavior?

A question that should be both made visible and enabled by the trigger, appears and is editable, but has sd-element__title--disabled css class

What is the expected behavior?

A question that should be both made visible and enabled by the trigger, should appear and be editable, without sd-element__title--disabled css class

How would you reproduce the current behavior (if this is a bug)?

  1. Open Preview tab
  2. Click Yes in question1. question2 appears normally.
  3. Click No in question1. question2 disappears.
  4. Click Yes in question1. question2 appears, but with sd-element__title--disabled css class. image

    Provide the test code and the tested page URL (if applicable)

    Tested page URL: https://codesandbox.io/s/reproduce-survey-creator-trigger-toggle-nx1r6r?file=/src/App.tsx Test code

    import { SurveyCreatorComponent, SurveyCreator } from "survey-creator-react";
    import "survey-core/defaultV2.min.css";
    import "survey-creator-core/survey-creator-core.min.css";
    const creator = new SurveyCreator();
    creator.JSON = {
    logoPosition: "right",
    pages: [
    {
      name: "page1",
      elements: [
        {
          type: "boolean",
          name: "question1",
          description: "Toggle me on and off"
        },
        {
          type: "text",
          name: "question2",
          visibleIf: "{question1} = true",
          enableIf: "{question1} = true"
        }
      ]
    }
    ]
    };
    export default function App() {
    return <SurveyCreatorComponent creator={creator} />;
    }

    Specify your

    • browser: Google Chrome v111.0.5563.147 (Official Build) (64-bit)
    • editor version: survey-creator-react v1.9.79
JaneSjs commented 1 year ago

Hello @d3n13, Thank you for reporting this issue. We will research it and get back to you shortly.

Note: the issue is reproduced in Survey Creator only (https://codesandbox.io/s/reproduce-survey-creator-trigger-toggle-nx1r6r?file=/src/App.tsx). In a standalone form library everything works as expected (https://plnkr.co/edit/LMsKhoEBHX3fad1L).