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.23k stars 820 forks source link

Bug: Dropdown search bar is visible when "searchEnabled" is set to false #4664

Closed StephBrouil closed 2 years ago

StephBrouil commented 2 years ago

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

Bug

What is the current behavior?

The dropdown search bar is visible when searchEnabled is set to false (with more than 10 choices).

What is the expected behavior?

The dropdown shouldn't display the search bar when searchEnabled is set to false.

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

Using the test page provided below, you'll notice that the search bar in the dropdown is visible even though searchEnabled is set to false in the survey json.

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

Tested page URL:

https://plnkr.co/edit/nFz6LbiR0UflYpnD

Test code

Survey.StylesManager.applyTheme("defaultV2");
var json = {
  "elements": [
    {
      "type": "dropdown",
      "name": "car",
      "choices": [
        "Ford",
        "Vauxhall",
        "Volkswagen",
        "Nissan",
        "Audi",
        "Mercedes-Benz",
        "BMW",
        "Peugeot",
        "Toyota",
        "Citroen",
        "Honda",
      ],
      "searchEnabled": false  
    }
  ]
};
window.survey = new Survey.Model(json);
survey.onComplete.add(function (sender) {
  document.querySelector('#surveyResult').textContent = "Result JSON:\n" + JSON.stringify(sender.data, null, 3);
});
var app = new Vue({
  el: '#surveyElement',
  data: {
    survey: survey
  }
});

Specify your

schlick commented 2 years ago

I've just come across this issue too. Good to know it's not me doing something wrong 😄

OlgaLarina commented 2 years ago

The issue was fixed by the pull request. Fix will be available in the nearest minor update.