From d7c20ba6e8f0675ad2fcd4fb41419de005ae3979 Mon Sep 17 00:00:00 2001
From: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com>
Date: Sat, 16 Jan 2021 22:31:50 +0300
Subject: 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 <47495861+HassanAbouelela@users.noreply.github.com>
---
 src/components/Question.tsx | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

(limited to 'src/components/Question.tsx')

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;
-- 
cgit v1.2.3

