-
Notifications
You must be signed in to change notification settings - Fork 12
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
va-table: add scrollable prop #1428
Conversation
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.
Hi @janechodance! 👋🏼 Do you mind adding a short description in the PR of the problem is and the solution being submitted here? That will help us understand a little faster instead of trying to work backwards through the linked ticket.
const classes = classnames({ | ||
'usa-table': true, | ||
'usa-table--stacked': stacked, | ||
'usa-table--borderless': tableType === 'borderless', | ||
}); | ||
return ( | ||
<div> | ||
<div tabIndex={isFocusable ? 0 : undefined}> |
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 adding the tab-index=0
to this div
essentially what you're wanting to use for keyboard tabbing into the table?
I'm going to tag in our a11y specialist Ryan on the PR because I sometimes get confused about when this is needed or not.
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.
Hi! Yes. the goal is to add tabIndex=0 to this div so the keyboard using user can tab focus to the table and use arrow keys to horizontal scroll.
packages/web-components/src/components/va-table/va-table-inner/va-table-inner.tsx
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/va-table/va-table-inner/va-table-inner.tsx
Outdated
Show resolved
Hide resolved
I added a description. Let me know if it makes sense. Thank you! |
Thanks @janechodance! I left a comment over on the ticket about trying to reproduce the original issue. |
Thanks again for your work here @janechodance! We discussed the scrollable behavior internally and what we'd like to do is update the component so that the scrollable container and focus are combined into a single setting. This would make scrolling + focus opt-in for larger/dense tables and smaller tables that don't need scrolling or an extra focus tab could continue to opt-out. The default will continue to be stacked for smaller screens. The implementation should be based on the USWDS guidelines for the scrollable table variation so we're hoping this PR could be updated with the following:
Let us know if you have any concerns, thoughts, or issues with any of that though. |
@jamigibbs Thank you! I will work on this and send an updated PR to you! |
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 have just a few small things that I think would improve these updates but overall it looks great!
'rows': data, | ||
'columns': defaultColumns, | ||
'scrollable': true, |
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 looks like the WithPagination Storybook variation needs the scrollable
prop too because it contains more content. I'm unable to scroll it now on small screens (before it stacks). Can you add that prop to that story too?
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.
@janechodance I noticed one more thing from the USWDS example; the default behavior for scrollable tables is to also have stacked
set to false
.
Originally we were thinking that we'd let it stack on small screens but I'm going to tag @rsmithadhoc to get his thoughts about if we should add the stacked: false
prop to our scrollable Storybook example so that it matches USWDS? 🤔 I think I'm fine either way but just looking for a sanity check.
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.
@janechodance I noticed one more thing from the USWDS example; the default behavior for scrollable tables is to also have
stacked
set tofalse
.Originally we were thinking that we'd let it stack on small screens but I'm going to tag @rsmithadhoc to get his thoughts about if we should add the
stacked: false
prop to our scrollable Storybook example so that it matches USWDS? 🤔 I think I'm fine either way but just looking for a sanity check.
@jamigibbs I think I initially said make it stacked by default when we first did the table, just to eliminate any work from teams. However, I'm not too tied to that idea, so I could also go either way. I think the prop would give teams all the options at their disposal, so it might be the most flexible option.
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.
@rsmithadhoc Thanks Ryan! Yes, I agree it would be good to see the flexibility with the options.
Chromatic
https://patch-bmt2-va-table-focusable-prop--65a6e2ed2314f7b8f98609d8.chromatic.com
Description
The Your VA Payments view has a table of payments that starts to extend outside the right edge of the viewport when I zoom my browser to 200-250%. This could prevent some users from seeing all of the data without zooming in to a higher resolution where the table adjusts to our responsive layout. Screenshot attached below.
Closes
department-of-veterans-affairs/va.gov-team#95134
QA Checklist
Screenshots
va.table.focusable.mov
va.table.focusable.mobile.mov
Acceptance criteria
Definition of done