fix: DataGrid reformatted to table and aria-sort added#2998
fix: DataGrid reformatted to table and aria-sort added#2998codecademydev merged 50 commits intomainfrom
table and aria-sort added#2998Conversation
|
View your CI Pipeline Execution ↗ for commit 0e23544. ☁️ Nx Cloud last updated this comment at |
This reverts commit e0003aa.
table and aria-sort added
…to cass-gm-945-i
There was a problem hiding this comment.
Preview works and looks great!
VO now recognizes the table as a table and appropriately semantic rows, headers, and cells. Filtering sounds good too. And the aria-sort shows up as well for sorting.
As I was going through the code to get an understanding of the changes, I was wondering about naming conventions — to try and separate out how components could be tied to their semantic HTML counterpart.
Left some thoughts for clean up but functionally, the changes look great :)
|
|
||
| return ( | ||
| <ListCol {...colProps}> | ||
| // TO-DO: Fix type issues |
There was a problem hiding this comment.
Are the type issues fixed?
I don't see any locally.
There was a problem hiding this comment.
oop, they are! will remove
| return ( | ||
| <ListRow expanded={expanded} renderExpanded={renderExpandedContent}> | ||
| <ListRow | ||
| as="tr" |
There was a problem hiding this comment.
Food for thought: since both HeaderRow.tsx and Row.tsx are specific to tables, would renaming these components and folder to be table-specific make sense?
e.g. Tables/TableHeader.tsx and Tables/TableRow.tsx respectively?
There was a problem hiding this comment.
And then maybe move over TableHeader.tsx?
There was a problem hiding this comment.
love it, will change
| variant={variant} | ||
| scrollable={scrollable} | ||
| ref={ref} | ||
| as="tr" |
There was a problem hiding this comment.
Can HeaderEl be a styled tr instead? atm it's a styled div. See:
https://github.com/Codecademy/gamut/blob/cass-gm-945-i/packages/gamut/src/List/elements.tsx
There was a problem hiding this comment.
maybe it should be like HeaderRowEl?
There was a problem hiding this comment.
going into a rabbit hole of sorts — so feel free to disregard lol
but headerVariants seem like it's not used for anything else and only applies a borderBottom to table.
So maybe lump that into the CSS styling and do away with this variant altogether?
There was a problem hiding this comment.
great call out, will refactor!
There was a problem hiding this comment.
i found out this is different between DataList v DataTable so keeping the variants as is but refactored to tr
| return ( | ||
| <ListHeader> | ||
| <TableHeader> | ||
| <> |
There was a problem hiding this comment.
Is this fragment needed anymore?
packages/gamut/src/List/elements.tsx
Outdated
| header: { | ||
| ...headerStyles, | ||
| }, | ||
| // Keeping this within variants for typing purposes, we we use this behaviorally despite it not needing specific styling |
There was a problem hiding this comment.
nit: extra "we" in this sentence
| const content = | ||
| isEmpty || loading ? ( | ||
| <Box | ||
| as="table" |
There was a problem hiding this comment.
is this as needed? looks like the parent element sets the as and content seems like it could be other elements
There was a problem hiding this comment.
actually, can this Box and the parent Box actually be combined?
There was a problem hiding this comment.
i'll test it out! i think we were using it for some positioning reason, but i think i've changed this enough that we don't need it anymore
| export interface RowProps | ||
| extends Partial<PublicListProps<ComponentProps<typeof RowEl>>> { | ||
| header?: boolean; | ||
| /** This is an internal prop that is largely only used for the DataTable component */ |
There was a problem hiding this comment.
Since RowProps are used for DataRow, used in DataGrid, would be more accurate to say used for the "DataTable and DataList components"?
| ? { ...rowConfig, ...rowProps } | ||
| : { spacing: keepSpacingWhileExpanded ? rowConfig.spacing : undefined }; | ||
| let content = children; | ||
| const renderNumbering = isOl && renderExpanded === undefined && !onClick; |
There was a problem hiding this comment.
nit: is there a falsy value other than undefined for renderExpanded?
If not, maybe !renderExpanded && !onClick can be a variable, like isNotInterative?
packages/gamut/src/List/elements.tsx
Outdated
| ); | ||
|
|
||
| export const StickyColumnWrapper = styled.div( | ||
| export const StickyColumnWrapper = styled.th( |
There was a problem hiding this comment.
nit: consider renaming to StickyHeaderWrapper? Or StickyHeaderColWrapper?
LinKCoding
left a comment
There was a problem hiding this comment.
Working and looking great tho!
|
🚀 Styleguide deploy preview ready! |
📬Published Alpha Packages:@codecademy/gamut@57.7.3-alpha.0e2354.0 |
Overview
Refactors the DataTable + DataList components to properly be semantic HTML tables and adds
aria-sortto the appropriate controlsPR Checklist
Testing Instructions
PR Links and Envs