aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Question.tsx
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-01-16 22:31:50 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-01-16 22:35:16 +0300
commitd7c20ba6e8f0675ad2fcd4fb41419de005ae3979 (patch)
tree235c151e941623acd14b86b2cb7375742ef745c8 /src/components/Question.tsx
parentMinor 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.tsx11
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;