-
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
Improve a11y of autofill assessment table #1019
Conversation
Co-authored-by: Gig <[email protected]>
@@ -177,6 +171,15 @@ const GenericTable = <T extends { id: string }>({ | |||
[] | |||
); | |||
|
|||
const getHeaderCellContents = useCallback((def: ColumnDef<T>) => { |
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.
This doesn't need to be a callback, it could be an external function similar to renderCellContents
since it doesn't rely on any data from the component. I think that would be nice to match the pattern we already have:
const renderHeaderCellContents = <T extends { id: string }>(
def: ColumnDef<T>
) => {
return def.header ? (
<strong>{def.header}</strong>
) : (
// If header isn't provided, add a visually hidden header with the column key for accessibility
<Box sx={visuallyHidden}>{def.key}</Box>
);
};
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.
Thanks, I like this better too!
@@ -80,24 +81,16 @@ const clickableRowStyles = { | |||
cursor: 'pointer', | |||
}; | |||
|
|||
const HeaderCell = ({ | |||
children, | |||
sx, |
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
aria-label={`Select record from ${record.assessmentDate}`} | ||
> | ||
Select | ||
</Button> |
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.
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 comment
The 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.
@gigxz I think this is ready for re-review or just merge, let me know what you think! |
Looks good, thanks for the nudge! |
Description
GH issue: https://github.com/open-path/hmis-accessibility/issues/139
I'm opening this PR against #998, in order to build on that work related to visually hidden column headers. (That PR addresses horizontal tables only, so this PR consolidates and applies the same logic to vertical tables.)
Summary of changes:
GenericTable
doesn't currently receive therecordType
prop, I implemented this as a new prop onGenericTable
calledverticalHiddenHeader
, which is"${recordType} attributes"
, passed byGenericTableWithData
. Let me know what you think about this approach. I'd be happy for feedback on the naming too.verticalCellSx
to this cell, so that it gets a left borderrowheader
role to row headers in vertically oriented tablesNot done in this PR:
Type of change
Accessibility improvement
Checklist before requesting review