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.11k stars 801 forks source link

Rating Scale: A double click doesn't unselect a rate value if it's not a number #8693

Closed ocobble closed 1 month ago

ocobble commented 1 month ago

Hello,

I believe this is a bug, but it there is a workaround, please let me know.

When you select "Auto-generate" for the rating configuration of a rating question, you are able to deselect answers by clicking on them. However, if you choose "manual" and create your own options, the answers are no longer able to be deselected.

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

Reporting a bug.

What is the current behavior?

Selecting "manual" for the rating configuration of a rating question causes answers to not be deselectable.

What is the expected behavior?

Rating answers should be able to be deselected for all types of rating questions.

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

See this example survey. The answers in the first question can be deselected, but the ones in the second question cannot. Also see the third example, which was a question where I selected "Auto-generate" at first and then changed it to "manual." I edited the first answer choice to have a text label. The first answer cannot be deselected, but the rest of the answers can.

{
  "title": "Rating Examples",
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "rating",
          "name": "question1",
          "title": "Auto-generate rating",
          "rateCount": 3,
          "rateMax": 3
        },
        {
          "type": "rating",
          "name": "question2",
          "title": "Manual rating",
          "autoGenerate": false,
          "rateCount": 3,
          "rateValues": [
            {
              "value": "1",
              "text": "option 1"
            },
            {
              "value": "2",
              "text": "option 2"
            },
            {
              "value": "3",
              "text": "option 3"
            }
          ]
        },
        {
          "type": "rating",
          "name": "question3",
          "title": "Mixed option types",
          "autoGenerate": false,
          "rateValues": [
            "option 1",
            2,
            3,
            4,
            5
          ]
        }
      ]
    }
  ]
}

Specify your

JaneSjs commented 1 month ago

Hello, Thank you for reporting this issue and sharing a sample JSON. I reproduced the issue on my end (View Demo).

https://github.com/user-attachments/assets/190705cc-72ec-4a6e-b2bb-baab0774d62d

We will research it and update you as soon as we get any news to share.

ocobble commented 1 month ago

Thank you!