Skip to content
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

Merged
merged 9 commits into from
Mar 30, 2021

Conversation

nicolethoen
Copy link
Contributor

What: Closes #5016

@nicolethoen
Copy link
Contributor Author

I know there is still some clean up to do around aria attributes, and possibly documentation.
That's what I'll be working on while I wait for more feedback.

@patternfly-build
Copy link
Contributor

patternfly-build commented Mar 25, 2021

@nicolethoen
Copy link
Contributor Author

Im looking into allowing a partially selected checkbox state

@nicolethoen nicolethoen requested a review from mturley March 25, 2021 18:24
@nicolethoen
Copy link
Contributor Author

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.

jessiehuff
jessiehuff previously approved these changes Mar 26, 2021
Copy link
Contributor

@jessiehuff jessiehuff left a 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.

Copy link
Contributor

@mattnolting mattnolting left a 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).

mattnolting
mattnolting previously approved these changes Mar 26, 2021
Copy link
Contributor

@mattnolting mattnolting left a 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! 🎉🎉🎉

Copy link
Collaborator

@jschuler jschuler left a 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}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be removed?

Copy link
Contributor Author

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.

packages/react-table/src/components/Table/TableTypes.ts Outdated Show resolved Hide resolved
packages/react-table/src/components/Table/TableTypes.ts Outdated Show resolved Hide resolved
isHidden,
level: level,
posinset: posinset,
setsize: x.children ? x.children.length : 0,
Copy link
Collaborator

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

Copy link
Contributor Author

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.

What do you vote? @tlabaj @kmcfaul?

Copy link
Contributor

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/TableComposable/Tr.tsx Outdated Show resolved Hide resolved
@nicolethoen nicolethoen force-pushed the modify_tree_view_with_table branch from e66ef64 to 4f7ab69 Compare March 29, 2021 16:44
@nicolethoen
Copy link
Contributor Author

I will have opened three follow up issues -

  1. Add the roving tabindex to enhance the keyboard accessibility Table: Tree table - use roving tabindex to update keyboard accessibility #5596
  2. Update the example to demonstrate how the consumer can use group checking, where checking a checkbox will check all children rows, and checking a children row will partially check a parent row Table: Tree table - update checkbox behavior in examples #5597
  3. Allow an icon to be included in each row to make the core examples. Table: Tree table - add icon to tree rows #5598

Comment on lines 2005 to 2006
- `posinset` - number representing where in the order this node sits amongst its siblings
- `setsize` - number representing the number of children this node has
Copy link
Member

@dlabrecq dlabrecq Mar 29, 2021

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,
Copy link
Contributor

@kmcfaul kmcfaul Mar 29, 2021

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@jessiehuff jessiehuff left a 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.

@nicolethoen
Copy link
Contributor Author

nicolethoen commented Mar 29, 2021

@jessiehuff
so, the attributes getting flagged by the tests are attached to the styles. For example if it has aria-level='3', the css knows to indent it three times. at this point we cannot remove the problematic attributes. But I can remove the roles i just added to get the tests to pass.

I think our only option for this PR is to try and skip the examples in the testing...
@jschuler could you help me figure out how to modify the script to do that?

Copy link
Member

@mcarrano mcarrano left a 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 !

Copy link
Contributor

@jessiehuff jessiehuff left a 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. 😄

@redallen redallen merged commit 6577d4f into patternfly:master Mar 30, 2021
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-docs@5.17.0
  • @patternfly/react-inline-edit-extension@4.6.64
  • @patternfly/react-table@4.24.0
  • @patternfly/react-virtualized-extension@4.7.0

Thanks for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tree Table implementation
10 participants