-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(a11y): Remove disabled button from Question
component
#3149
Conversation
Question
component
Removed vultr server and associated DNS entries |
- Add validation for `a` - Get test functions from `setup()` - Add `describe()` blocks
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.
Thank you for picking this one up!!
Two small comments/questions before merging, but looks nearly good to go & working as expected on pizza !
validationSchema: object({ | ||
selected: object({ | ||
id: string().required("Select your answer before continuing"), | ||
a: mixed().required().test(value => |
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.
selected.a
can be undefined
in initialValues
- is it actually required here or optional?
Also nice to see the mixed()
syntax in action 💪
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.
Good question! I think what I have is correct, as this is a required value at time of submission.
When the component loads the value is not set as it doesn't exist (so it's optional in the props). When navigating "back" it will be set already. The value for selected.a
is set alongside selected.id
here -
planx-new/editor.planx.uk/src/@planx/components/Question/Public/Question.tsx
Lines 115 to 116 in 6193731
formik.setFieldValue("selected.id", response.id); | |
formik.setFieldValue("selected.a", response.responseKey); |
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.
That distinction makes sense - thanks for clarifying!
container | ||
spacing={layout === QuestionLayout.Basic ? 0 : 2} | ||
alignItems="stretch" | ||
<ErrorWrapper id={`${props.id}-error`} error={formik.errors.selected?.id}> |
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.
nit: the ErrorWrapper
component already prepends error-message-
to whatever id
is set here, so no need to explicitly use -error
suffix as you have
What does this PR do?
Question
componentsTest flow here with all variants of the question component - https://3149.planx.pizza/testing/question-error-test