Skip to content
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

fix(a11y): Input grouping, fieldset and legend #2976

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion editor.planx.uk/src/@planx/components/Checklist/Public.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import Box from "@mui/material/Box";
import Grid from "@mui/material/Grid";
import { visuallyHidden } from "@mui/utils";
import type { Checklist, Group } from "@planx/components/Checklist/model";
import ImageButton from "@planx/components/shared/Buttons/ImageButton";
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import { getIn, useFormik } from "formik";
import React, { useState } from "react";
import InputLegend from "ui/editor/InputLegend";
import { ExpandableList, ExpandableListItem } from "ui/public/ExpandableList";
import FormWrapper from "ui/public/FormWrapper";
import FullWidthWrapper from "ui/public/FullWidthWrapper";
Expand Down Expand Up @@ -140,7 +142,13 @@ const ChecklistComponent: React.FC<Props> = ({
/>
<FullWidthWrapper>
<ErrorWrapper error={getIn(formik.errors, "checked")} id={id}>
<Grid container spacing={layout === ChecklistLayout.Images ? 2 : 0}>
<Grid
container
spacing={layout === ChecklistLayout.Images ? 2 : 0}
component="fieldset"
sx={{ border: "none", padding: 0 }}
>
<legend style={visuallyHidden}>{text}</legend>
{options ? (
options.map((option) =>
layout === ChecklistLayout.Basic ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ const Question: React.FC<IQuestion> = (props) => {
img={props.img}
/>
<FullWidthWrapper>
<FormControl sx={{ width: "100%" }}>
<FormControl sx={{ width: "100%" }} component="fieldset">
<FormLabel
component="legend"
style={visuallyHidden}
id={`radio-buttons-group-label-${props.id}`}
>
Expand Down
8 changes: 6 additions & 2 deletions editor.planx.uk/src/components/Feedback/MoreInfoFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ const MoreInfoFeedbackComponent: React.FC = () => {
function FeedbackYesNo(): FCReturn {
return (
<MoreInfoFeedback>
<Container maxWidth={false}>
<Typography variant="h4" component="h3" gutterBottom>
<Container
maxWidth={false}
component="fieldset"
sx={{ border: "none" }}
>
<Typography variant="h4" component="legend" gutterBottom>
Did this help to answer your question?
</Typography>
<Box>
Expand Down
Loading