-
Notifications
You must be signed in to change notification settings - Fork 355
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
feat(Table): Add Tree Table variant #5573
feat(Table): Add Tree Table variant #5573
Conversation
I know there is still some clean up to do around aria attributes, and possibly documentation. |
PF4 preview: https://patternfly-react-pr-5573.surge.sh |
Im looking into allowing a partially selected checkbox state |
confirmed - a partially checked checkbox is possible. We could build an example or demo in a future story to show how to wire up the checkboxes to cascade up. |
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 looks pretty good, Nicole! 🙂 I tested with VO, and it sounded great. It doesn't quite meet the keyboard interaction expectations that are typically expected for a tree view (arrow key functionality in particular), but I know that we're trying to get this in so perhaps we can open another issue for the keyboard functionality? I detailed some of the keyboard expectations here, and I would expect it to follow these guidelines.
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 looks great @nicolethoen!
Two things, can we wrap the primary or title th
with pf-c-table__tree-view-title-cell
and can we remove pf-m-grid-md
(bc that will never really work for tree view).
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.
Excellent work, @nicolethoen! LPTM! 🎉🎉🎉
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.
Nice job @nicolethoen looks pretty good! just some minor things here.
Also, i noticed in the demo that when i checked a parent, the children were not automatically checked, i would expect them to be
@@ -243,7 +246,6 @@ export class Table extends React.Component<TableProps, {}> { | |||
role={role} | |||
variant={variant} | |||
borders={borders} | |||
className={className} |
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.
should this be removed?
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 had changed the props a handful of times while working on this, so in the end while cleaning stuff up, I guess I realized that className
was being pulled out of props
unnecessarily on line 161. I can put it back, but it's now passed when I spread props to the Provider on line 230.
isHidden, | ||
level: level, | ||
posinset: posinset, | ||
setsize: x.children ? x.children.length : 0, |
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.
can this be camel cased everywhere? setSize
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.
it could, but the aria attribute is not camel cased (i.e. aria-posinset
, aria-setsize
), so I figured it was less confusing to format it the same way. I could also just use the actual aria attribute name, but number of quotes i'd need to wrap the attribute name annoyed me.
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 using 'aria-posinest'
and 'aria-setsize'
with quotes would be the clearest. Or at least having "aria" in the property name to be clear what the prop is intended for ( i.e. ariaPosInset
/ ariaSetSize
)
packages/react-table/src/components/Table/utils/decorators/treeRow.tsx
Outdated
Show resolved
Hide resolved
packages/react-table/src/components/Table/utils/decorators/treeRow.tsx
Outdated
Show resolved
Hide resolved
e66ef64
to
4f7ab69
Compare
I will have opened three follow up issues -
|
- `posinset` - number representing where in the order this node sits amongst its siblings | ||
- `setsize` - number representing the number of children this node has |
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 know this is an example, but would prefer to see aria-posinset
and aria-setsize
here, mainly because nothing indicates these are aria attributes.
export const TreeRowWrapper: React.FunctionComponent<RowWrapperProps> = ({ | ||
className, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
rowProps, |
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.
Is rowProps
something used in only non-composable tables? Why is it being withheld from spreading to the Tr?
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 am not totally sure all the reasons the rowData prop exists. At the very least it keeps track of rowIndex and rowKey for the sake of certain callback functions. But, I know that it's already being withheld in the RowWrapper, and if I don't withhold it in the TreeRowWrapper, it spreads all the way to the <tr>
element and causes a console warning.
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.
Unfortunately the new roles seem to break accessibility for screen readers. 😞 When testing in VO, it reads "Tree Table, table, 4 columns 1 row", I'm able to get it to read each of the column headers, but then it says "end of table" without ever getting to the tree table content itself. I don't think the tree and treeitem roles are working well with the table elements, but that's a theory. I tested in JAWS and NVDA as well. JAWS was at least able to make slightly more of a guess, but it separated the headers and the tree table content so it announced the top part as a table and then only viewed the content as a tree view component (gave no features of a table, for example it never announced the column headers as you're navigating the content, just announces it as "tree view" then reads out all of the text). In NVDA, I had difficulty navigating it. It seemed to kind of work at times, other times it would jump around. When trying to expand sections, it would check the previous section, etc. I would describe the interaction as odd for lack of a better word.
If we want to keep the tests, I'd rather remove the attributes getting flagged and add them back later, but ideally I'd love for axe-core to turn on support for these attributes so we can follow the W3 example. There's already an open issue for it with Axe that Sarah Higley (a big name/thought leader in the a11y community) opened for the same reason we've run into. I can comment on that issue and mention our use case to hopefully get that pushed along so we can add these attributes as well.
@jessiehuff I think our only option for this PR is to try and skip the examples in the testing... |
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 looks great from my perspective. Thanks for all the work on this @nicolethoen !
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 looks awesome, Nicole!!!! 🎉 🏆 Thank you so much for all of your effort on this, you did a phenomenal job. I just tested in VO, NVDA, and JAWS, and all of them work like a dream with this structure. 😄
Your changes have been released in:
Thanks for your contribution! 🎉 |
What: Closes #5016