diff options
author | 2021-01-16 22:31:50 +0300 | |
---|---|---|
committer | 2021-01-16 22:35:16 +0300 | |
commit | d7c20ba6e8f0675ad2fcd4fb41419de005ae3979 (patch) | |
tree | 235c151e941623acd14b86b2cb7375742ef745c8 /src/components/Question.tsx | |
parent | Minor Style Adjustments (diff) |
Rewrites Components For Accessibility
Makes major changes to the structuring of checkboxes, and ranges to be
more accessible to all users.
Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'src/components/Question.tsx')
-rw-r--r-- | src/components/Question.tsx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/components/Question.tsx b/src/components/Question.tsx index 54074f3..e1472e4 100644 --- a/src/components/Question.tsx +++ b/src/components/Question.tsx @@ -46,12 +46,13 @@ class RenderedQuestion extends React.Component<QuestionProp> { let value: string | boolean; switch (event.target.type) { - case QuestionType.Checkbox: - target = this.props.question.id; + case "checkbox": + target = event.target.name; value = event.target.checked; break; - case QuestionType.Radio: + case "radio": + // This handles radios and ranges, as they are both based on the same fundamental input type target = "value"; if (event.target.parentElement) { value = event.target.parentElement.innerText.trimEnd(); @@ -60,10 +61,6 @@ class RenderedQuestion extends React.Component<QuestionProp> { } break; - case QuestionType.Select: - // Handled by component - return; - default: target = "value"; value = event.target.value; |