Radiogroup & Checkboxes not auto-focused when going to next page
See original GitHub issueAre you requesting a feature, reporting a bug or asking a question?
Bug
What is the current behavior?
Currently in the new version 1.0.56, after going to the next page, the first question is not auto-focused if it’s a radiogroup or checkbox group (instead it focuses the Next button).
What is the expected behavior?
First choice should be auto-focused.
How would you reproduce the current behavior (if this is a bug)?
In the sample React survey in the examples/react
folder, copy-paste the below JSON
Provide the test code and the tested page URL (if applicable)
Test JSON
{
"pages": [{
"name": "page1",
"elements": [{
"type": "text",
"name": "CC_01",
"title": "How old are you?",
"isRequired": true,
"validators": [{
"type": "numeric",
"minValue": 18,
"maxValue": 99
}],
"placeHolder": "(years)"
}]
},
{
"name": "page2",
"elements": [{
"type": "radiogroup",
"name": "CC_02",
"title": "What is your sex?",
"isRequired": true,
"choices": [{
"value": "M",
"text": "Male"
},
{
"value": "F",
"text": "Female"
}
]
}]
},
{
"name": "page3",
"elements": [{
"type": "checkbox",
"name": "CC_03",
"title": "Favourite colours?",
"isRequired": true,
"choices": [{
"value": "B",
"text": "Blue"
},
{
"value": "R",
"text": "Red"
}
]
}]
}
]
}
Specify your
- browser: Chrome
- browser version: 70.0.3538.77
- surveyjs platform (angular or react or jquery or knockout or vue): react
- surveyjs version: 1.0.56
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Vue, autofocus on radio button - Stack Overflow
I am trying to autofocus on the first radio button so that the user can automatically began cycling through answers with the tab...
Read more ><input type="radio"> - HTML: HyperText Markup Language
A radio group is defined by giving each of radio buttons in the group the same name . Once a radio group is...
Read more >Tabbing through form never gives focus to radio buttons or c
Hello, I'm having an issue where when I have either radio buttons or checkboxes on a form in Angular they never gain focus...
Read more >Radio | NextUI - Beautiful, fast and modern React UI Library
Radio.Group : Radio group component that holds all radios in a group and provides a common API for managing the group state. Radio:...
Read more >HTML DOM Input Radio autofocus property - Tutorialspoint
Setting the autofocus property. ... Here, true represents the radio button should get focus and false represents otherwise. It is set to false...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ekim-novus Thank you for investigations. You are absolutely right. I’ve moved setSurveyEvents into updateSurvey method. If functional tests will be ok, I’ll leave this solution.
@tsv2013 I just discovered that the reason
onCurrentPageChangedHandler
was not being called, is because a second ReactSurveyModel is being created, which replaces the first one.Working In the example React survey, when the survey initially loads:
updateSurvey()
which creates a new ReactSurveyModelsetSurveyEvents()
, which adds theonCurrentPageChangedHandler
componentWillReceiveProps()
is not calledNot Working However, in my local project, when the survey loads:
updateSurvey()
creates a new ReactSurveyModelsetSurveyEvents()
is not called, soonCurrentPageChangedHandler
is not addedAs a suggestion, should setSurveyEvents() be called right after updateSurvey() inside
componentWillReceiveProps
? Unless that may cause other issues.