-
-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Survey plugin rewrite (fixes #2758) #3204
Conversation
🦋 Changeset detectedLatest commit: e807de4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…pdown input (because otherwise the option text is hidden)
…g trials in a loop
Just chiming in to say I'm very excited to see this PR happen, it's going to be a big improvement, so thanks for all the work and good luck for the remaining bits 💪 |
@DominiqueMakowski Thanks!! So glad to hear this will be appreciated - I agree it's going to be a big improvement. I'll finish this up ASAP, just working on the docs now. |
|
||
// This example shows how to make some questions conditional on previous answers | ||
// from the same survey trial. | ||
const vegetables = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the location of the next button change in this demo? If I select neutral it is on the right, otherwise in the center.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks for flagging this. I fixed this.
The reason was that there are actually 3 nav buttons at the bottom of the page: previous, next, and complete. And depending on the participants response, they are either done with the survey (selected neutral) or going on to another page. I fixed this by adding some CSS that takes the 'complete' button out of the page flow (display: none
) when it is hidden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: this means that the buttons could potentially move on the page (if a response is made that changes the visibility of 'complete' without also removing the 'next' button), or the button could stay in the same place but the label would change between 'next' and 'complete'. I think this is still preferable to having weird previous/next button placement because of a 'complete' button that is in the page flow but hidden.
hey @becky-gilbert this is awesome. left just a few minor things to adjust or consider. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late to the party, sorry! Wanted to add a quick reminder about removing the build outputs, but saw you did that already on main
👍
|
||
StylesManager.applyTheme(); | ||
applyStyles(survey) { | ||
// TO DO: this method of applying custom styles is deprecated, but I'm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Time to get rid of this?
|
||
StylesManager.applyTheme(); | ||
applyStyles(survey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be private?
Thanks for coming back to this @bjoluc!
Yeah, sorry for forgetting to do this here |
Fixes #2758
This PR rewrites the
survey
plugin so that it works as a wrapper for SurveyJS. Now any SurveyJS-compatible JSON can be passed directly into the plugin, which allows jsPsych users to use all SurveyJS features without our having to implement them in the plugin.The updated SurveyJS architecture requires the survey-core package along with one of the following UI/rendering packages: react, angular, vue, knockout, jquery. I've switched from knockout to jquery because jquery seems to require the least/simplest deviations from our conventional plugin design/style.
To do:
Requests for feedback:
SurveyJS has a number of pre-defined themes that you can see here: https://surveyjs.io/form-library/documentation/manage-default-themes-and-styles. I think we'll probably want to make at least a few customizations to get the style to match the rest of jsPsych's default style a little more closely. Unfortunately I can't find a comprehensive list of the SurveyJS CSS variables and their meanings, so thus far I've been their online GUI tool to make theme edits and generate the corresponding CSS variables/values, which is slow
Examples and screenshots
Example: checkbox/multi-select, conditional question display, and carrying answers forward to next question
Rank question is hidden until at least two animals are selected in the checkbox question:
Data: