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

va-table: add scrollable prop #1428

Merged
merged 12 commits into from
Dec 12, 2024
Merged

Conversation

janechodance
Copy link
Contributor

@janechodance janechodance commented Dec 6, 2024

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.
image

Closes
department-of-veterans-affairs/va.gov-team#95134

QA Checklist

  • Component maintains 1:1 parity with design mocks
  • Text is consistent with what's been provided in the mocks
  • Component behaves as expected across breakpoints
  • Accessibility expert has signed off on code changes (if applicable. If not applicable provide reason why)
  • Designer has signed off on changes (if applicable. If not applicable provide reason why)
  • Tab order and focus state work as expected
  • Changes have been tested against screen readers (if applicable. If not applicable provide reason why)
  • New components are covered by e2e tests; updates to existing components are covered by existing test suite
  • Changes have been tested in vets-website using Verdaccio (if applicable. If not applicable provide reason why)

Screenshots

va.table.focusable.mov
va.table.focusable.mobile.mov

Acceptance criteria

  • QA checklist has been completed
  • Screenshots have been attached that cover desktop and mobile screens

Definition of done

  • Documentation has been updated, if applicable
  • A link has been provided to the originating GitHub issue (or connected to it via ZenHub)

@janechodance janechodance added the patch Patch change in semantic versioning label Dec 6, 2024
@janechodance janechodance marked this pull request as ready for review December 6, 2024 20:31
@janechodance janechodance requested a review from a team as a code owner December 6, 2024 20:31
Copy link
Contributor

@jamigibbs jamigibbs left a 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}>
Copy link
Contributor

@jamigibbs jamigibbs Dec 9, 2024

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.

Copy link
Contributor Author

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.

@jamigibbs jamigibbs changed the title Patch bmt2 va table focusable prop va-table: add focusable prop Dec 9, 2024
@jamigibbs jamigibbs requested a review from rsmithadhoc December 9, 2024 14:50
@janechodance
Copy link
Contributor Author

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.

I added a description. Let me know if it makes sense. Thank you!

@jamigibbs
Copy link
Contributor

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.

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.

@jamigibbs
Copy link
Contributor

jamigibbs commented Dec 10, 2024

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:

  • change the prop name from isFocusable to scrollable
  • update the prop description to say:
    • When active, the table can be horizontally scrolled and is focusable.
  • default the prop to false
  • keep the tabindex=0 conditionally displaying on the container
  • also add the .usa-table-container--scrollable class to the same container when scrollable is true. It should already be available from the USWDS table module import.
  • remove the original overflow scrolling style added here. The .usa-table-container--scrollable styles should replace it.

Let us know if you have any concerns, thoughts, or issues with any of that though.


internal Slack discussion

@janechodance
Copy link
Contributor Author

@jamigibbs Thank you! I will work on this and send an updated PR to you!

@jamigibbs jamigibbs changed the title va-table: add focusable prop va-table: add scrollable prop Dec 11, 2024
Copy link
Contributor

@jamigibbs jamigibbs left a 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,
Copy link
Contributor

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?

Copy link
Contributor

@jamigibbs jamigibbs Dec 11, 2024

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.

Screenshot 2024-12-11 at 11 34 10 AM

Copy link
Contributor

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.

Screenshot 2024-12-11 at 11 34 10 AM

@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.

Copy link
Contributor

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.

@jamigibbs jamigibbs added minor For a minor Semantic Version change and removed patch Patch change in semantic versioning labels Dec 11, 2024
@janechodance janechodance merged commit 5557a4f into main Dec 12, 2024
8 checks passed
@janechodance janechodance deleted the patch-bmt2-va-table-focusable-prop branch December 12, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor For a minor Semantic Version change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[a11y-defect-3]: Payment History table extends past right edge of viewport at 200-250% browser zoom
3 participants