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.12k stars 802 forks source link

With "widthMode": "static" and "width": "65%", an input field takes up less space on mobile than expected #8831

Closed JaneSjs closed 4 days ago

JaneSjs commented 1 week ago

T19910 - Responsive survey https://surveyjs.answerdesk.io/internal/ticket/details/T19910


Try the following JSON:

{
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "text",
          "name": "question1"
        }
      ]
    }
  ],
  "widthMode": "static",
  "width": "65%"
}

On a desktop, an input field takes about 60% of the form width (expected): image

However, on a mobile, an input field takes approximately 50% of the form width: image

JaneSjs commented 4 days ago

Form elements have paddings around its elements. On wider screens such as desktop, those paddings take relatively small size comparing with the entire form width. image

However, on a mobile, these paddings may affect the overall form width. image

To decrease the form width on mobile screens, you may consider defining the form width in pixels instead.

{
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "text",
          "name": "question1"
        }
      ]
    }
  ],
  "widthMode": "static",
  "width": "1375px"
}

image