-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improve a11y of autofill assessment table #1019
Changes from all commits
05d57ed
3ca2844
d4f8372
3fac8a7
9aad6be
32c4da4
6f0c3ad
8368350
d744d24
8b51bd4
89b582e
50b472b
bb38721
3a3cf64
e47d030
7a4dd51
4c6d640
7211ab2
e26a57e
ae6b49a
3586e74
401f777
5c4d33a
2d2d133
a3b888a
197e12b
8b6a383
2feec78
f96f87d
359c9b8
2da7754
39eab24
e919970
5026d48
0c67ce0
39ce9ce
8613a8d
f91ea56
0380e2b
0605c2a
d5bd5aa
e316ed0
7686543
004ea99
9ffaa63
cee0dbf
5bc2ea6
bdde162
7339f04
eee782f
d2c8fc4
732dc47
edaf95e
42f9eef
848691a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { Stack } from '@mui/material'; | ||
import { Box } from '@mui/material'; | ||
import Button from '@mui/material/Button'; | ||
import { DialogProps } from '@mui/material/Dialog'; | ||
import DialogActions from '@mui/material/DialogActions'; | ||
import DialogContent from '@mui/material/DialogContent'; | ||
import DialogTitle from '@mui/material/DialogTitle'; | ||
import { visuallyHidden } from '@mui/utils'; | ||
import { startCase } from 'lodash-es'; | ||
import { ReactNode, useMemo } from 'react'; | ||
|
||
|
@@ -16,7 +17,10 @@ import { | |
getFieldOnAssessment, | ||
getPopulatableChildren, | ||
} from '@/modules/form/util/formUtil'; | ||
import { assessmentColumns } from '@/modules/form/util/recordPickerUtil'; | ||
import { | ||
ASSESSMENT_COLUMNS, | ||
assessmentColumns, | ||
} from '@/modules/form/util/recordPickerUtil'; | ||
import HmisField from '@/modules/hmis/components/HmisField'; | ||
import { AssessmentRole, FormItem, FormRole } from '@/types/gqlTypes'; | ||
|
||
|
@@ -40,10 +44,28 @@ const RecordPickerDialog = ({ | |
clientId, | ||
...other | ||
}: Props) => { | ||
const actionColumnDef: ColumnDef<AssessmentForPopulation> = useMemo(() => { | ||
return { | ||
key: 'Action', | ||
render: (record: AssessmentForPopulation) => ( | ||
<Button | ||
onClick={() => onSelected(record)} | ||
variant='outlined' | ||
size='small' | ||
sx={{ backgroundColor: 'white' }} | ||
fullWidth | ||
aria-label={`Select record from ${record.assessmentDate}`} | ||
> | ||
Select | ||
</Button> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the ticket only specified to address accessibility issues, but not adjust the overall UI of the table. This seems relatively minor, but it does lead to the user needing to scroll down within the modal to find the select buttons. Is it necessary to have the button in a separate cell for accessibility reasons? (If so maybe it can remain at the top in another row?). I think unless we have a strong reason to update it, we should probably leave it the same to reduce the impact on users. ![]() ![]() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see! Yes, I think to fix the accessibility issue, it does need to be moved out of the column header. Otherwise, the screenreader will read out the select button every time the user navigates from column to column. But, good idea to move it back to the top in order to reduce user impact. |
||
), | ||
}; | ||
}, [onSelected]); | ||
|
||
const columns: ColumnDef<AssessmentForPopulation>[] = useMemo(() => { | ||
// If no item was passed, that means we're pre-filling the entire assessment. | ||
// Only metadata columns are shown in that case. | ||
if (!item) return assessmentColumns; | ||
if (!item) return [actionColumnDef, ...assessmentColumns]; | ||
|
||
// Select additional fields to show in table based on child items in the group | ||
const dataColumns = getPopulatableChildren(item) | ||
|
@@ -69,8 +91,8 @@ const RecordPickerDialog = ({ | |
); | ||
}, | ||
})); | ||
return [...assessmentColumns, ...dataColumns]; | ||
}, [item]); | ||
return [actionColumnDef, ...assessmentColumns, ...dataColumns]; | ||
}, [actionColumnDef, item]); | ||
|
||
const hudRoles = [ | ||
AssessmentRole.Intake, | ||
|
@@ -123,7 +145,11 @@ const RecordPickerDialog = ({ | |
}} | ||
renderVerticalHeaderCell={(record) => { | ||
return ( | ||
<Stack spacing={2} sx={{ py: 1 }}> | ||
<> | ||
<Box sx={visuallyHidden}> | ||
{/* Additional visually hidden info about this assessment to help with accessibility when navigating the table */} | ||
{ASSESSMENT_COLUMNS.CollectionStage.render(record)} | ||
</Box> | ||
<RelativeDate | ||
dateString={record.assessmentDate} | ||
dateUpdated={record.dateUpdated || undefined} | ||
|
@@ -133,17 +159,7 @@ const RecordPickerDialog = ({ | |
withTooltip | ||
prefix='Assessment Date: ' | ||
/> | ||
<Button | ||
onClick={() => onSelected(record)} | ||
variant='outlined' | ||
size='small' | ||
sx={{ backgroundColor: 'white' }} | ||
fullWidth | ||
aria-label={`Select record from ${record.assessmentDate}`} | ||
> | ||
Select | ||
</Button> | ||
</Stack> | ||
</> | ||
); | ||
}} | ||
/> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really part of this diff, but maybe we can get rid of
headerCellSx
as we are standardizing tables - started thread https://www.figma.com/design/bsw8CX4UOq6SIdXYorZDWV?node-id=2424-868&m=dev#1081881485