From e49d09a5cf1c884d2118a2060307741c5c1a6239 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Thu, 7 Mar 2024 08:46:01 +0000 Subject: [PATCH] fix(a11y): change links reference descriptive list titles whether dynamic or static (#2868) --- .../components/shared/Preview/SummaryList.tsx | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx index 240b89a4f0..4b60e55c4b 100644 --- a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx +++ b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx @@ -15,6 +15,10 @@ import { FONT_WEIGHT_SEMI_BOLD } from "theme"; export default SummaryListsBySections; +/** These component types don't use their node title as the descriptive list title */ +const FIND_PROPERTY_DT = "Property address"; +const DRAW_BOUNDARY_DT = "Location plan"; + const Grid = styled("dl", { shouldForwardProp: (prop) => prop !== "showChangeButton", })<{ showChangeButton?: boolean }>(({ theme, showChangeButton }) => ({ @@ -251,7 +255,12 @@ function SummaryList(props: SummaryListProps) { > Change - {node.data?.title || node.data?.text || "this answer"} + {(node.type === TYPES.FindProperty && FIND_PROPERTY_DT) || + (node.type === TYPES.DrawBoundary && + DRAW_BOUNDARY_DT) || + node.data?.title || + node.data?.text || + "this answer"} @@ -314,7 +323,7 @@ function FindProperty(props: ComponentProps) { props.passport.data?._address; return ( <> -
Property
+
{FIND_PROPERTY_DT}
{`${single_line_address.split(`, ${town}`)[0]}`}
@@ -328,7 +337,7 @@ function FindProperty(props: ComponentProps) { const { x, y, title } = props.passport.data?._address; return ( <> -
Proposed address
+
{FIND_PROPERTY_DT}
{`${title}`}
@@ -342,7 +351,7 @@ function FindProperty(props: ComponentProps) { function Checklist(props: ComponentProps) { return ( <> -
{props.node.data.text ?? "Checklist"}
+
{props.node.data.text}