"prev" and "next" navigation buttons have click conflict to/from first survey page
See original GitHub issueAre you requesting a feature, reporting a bug or ask a question?
Reporting a bug
What is the current behavior?
When navigating back to the first page of a survey with the “prev” button, a click seems to register with both “prev” and “next” buttons. That, or a similar conflict is occurring (the plnkr and GIF below illustrates it best)
What is the expected behavior?
Clicking the “prev” button should not produce any effects associated with “next”.
How would you reproduce the current behavior (if this is a bug)?
I am animating the pages to slide into view with some jquery/css. If you add click events to either button, and navigate back to the first page, you will find a conflict.
Provide the test code and the tested page URL (if applicable)
This plnkr doesn’t show the css animation, but if you view the developer console while in plnkr and inspect the html elements as you click previous and next, you will see the incorrect class names being added/removed (‘slideInFromLeft’, ‘slideInFromRight’)
They are reversed when navigating to AND from the first page. The page should slide in from the right when you answer, or click next. It should slide from the left when you click previous. This is what I’m seeing locally (you can even see the incorrect button become active
with focus applied):
Specify your
- browser: Chrome
- browser version: 58
- surveyjs platform jquery
- surveyjs version: 0.12.16 dev version
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
For anyone interested as it turns out,
survey.onAfterRenderQuestion
was what I ended up using for getting the animation to work properly.When changing styles based on page changes, this is much more reliable than
survey.onCurrentPageChanged
.@dmitrykurmanov @andrewtelnov Sorry! I thought I had included it in the original description.
http://plnkr.co/edit/70RZCgNGsQQEiBjgEHPZ?p=preview
If you go to the last question (question 4), don’t complete the survey. Instead click Previous while looking at the developer console. You will see some console.log() statements.
If you click Previous, it should log “You clicked PREVIOUS” and if you click Next, “You clicked NEXT”
But once you hit the first page again, they trigger incorrectly, but somehow go to the correct page.