From db82d6ac57c1b975ed9c739cc6696bcbebbc1a80 Mon Sep 17 00:00:00 2001 From: Amberroseweeks Date: Sat, 2 Nov 2024 08:22:26 -0400 Subject: [PATCH] improving the checkbox by adding aria describedby and connecting the panel to the header --- src/components/Filters/DimensionFilter.tsx | 24 +++++++++++++++------- src/components/Filters/Panels.tsx | 5 +++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/components/Filters/DimensionFilter.tsx b/src/components/Filters/DimensionFilter.tsx index 0c7f374a..4e6eb080 100644 --- a/src/components/Filters/DimensionFilter.tsx +++ b/src/components/Filters/DimensionFilter.tsx @@ -19,10 +19,9 @@ type OptionDisplayMapping = { }; const optionsDisplayMapping: OptionDisplayMapping = { - owner_type: { - Public: 'Public', - 'Business (LLC)': 'Business (LLC)', - Individual: 'Individual', + llc_owner: { + Yes: 'Business', + No: 'Individual', }, }; @@ -48,6 +47,8 @@ const DimensionFilter: FC = ({ [property: string]: string[]; }>(initialSelectedPanelKeys()); + const filterLabelID = display.replace(/\s/g, ''); + const toggleDimensionForPanel = ( dimension: string, panel_property: string @@ -119,10 +120,13 @@ const DimensionFilter: FC = ({ ); } else if (type === 'panels') { return ( + /* the filterLabelID is pulled from the form field header text and uses aria-describedby to tie each component to the form header label using a unique ID applied to the form area header + */ ); } else { @@ -153,21 +157,27 @@ const DimensionFilter: FC = ({ return (
-

{display}

+

+ {display} +

{(property === 'get_access' || property === 'priority_level') && (

{filterDescription.desc} Learn more{' '}

)}
- {filter} +
{filter}
); }; diff --git a/src/components/Filters/Panels.tsx b/src/components/Filters/Panels.tsx index 97dc1dce..75153026 100644 --- a/src/components/Filters/Panels.tsx +++ b/src/components/Filters/Panels.tsx @@ -18,6 +18,7 @@ type PanelFilterOptions = PropertyAccessOption & { type PanelsProps = { options: string[] | PropertyAccess[]; selectedPanelKeys: { [property: string]: string[] }; + aria_describedby_label?: string; toggleDimensionForPanel: (dimension: string, property: string) => void; }; @@ -71,6 +72,7 @@ const Panels: FC = ({ options, selectedPanelKeys, toggleDimensionForPanel, + aria_describedby_label, }) => { const optionPanels = options.map((option, index) => { const panel = panel_access_options[option]; @@ -84,6 +86,9 @@ const Panels: FC = ({ return ( toggleDimensionForPanel(panel.dimension, panel.property)}