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

[EuiTablePagination] Adding a Show all option; Plus Pagination Guidelines #5547

Merged
merged 43 commits into from
Feb 22, 2022

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Jan 19, 2022

Guidelines

Can be found at /navigation/pagination/guidelines.

Internal only: Google doc for reference

EuiTablePagination

🔔 Breaking Change

This is a semi-trivial change, but I changed the name of the prop hidePerPageOptions to showPerPageOptions because I hate double-negative prop names. Boolean props should always be in the positive (with the exception of disabled since we inherit this from standard HTML). So that it's easier to read showPerPageOptions={false} vs hidePerPageOptions={true}.

Added the ability to present a "Show all" option by passing 'all' in the itemsPerPage array

If 0 doesn't seem appropriate, I'm up for suggestions (maybe -1 is better). But the idea is to not have to add yet another boolean prop but make it available as an option in the array. Unless someone can help @constancecchen helped me allow the term all into that prop's array as a different way to do this.

Screen Shot 2022-02-15 at 13 50 05 PM

When this option is selected, it will hide the numbered pagination and present the button text as "Showing all".

Screen Shot 2022-02-15 at 13 49 20 PM

Added a docs example for this component under Pagination / Table Pagination

With props tab and playground.

Screen Shot 2022-01-19 at 10 52 33 AM

Other small fixes

Fixed layout of EuiTablePagination when it's container is narrow

Before the layout added scrollbars, but the problem is that this visually prioritizes the "Rows per page" instead of the actual pagination numbers.

Screen Shot 2022-02-15 at 13 32 47 PM

After the layout has wrap on it, so without having to monitor the actual size of the container, if it's too narrow the pagination numbers will just wrap below the "Rows per page" first, then scroll if still necessary

Screen Shot 2022-02-15 at 13 33 23 PMScreen Shot 2022-02-15 at 13 57 25 PM

Fixed EuiImage images from staying restricted to it's parent container's width, by adding max-width: 100%:

Before
Screen Shot 2022-01-19 at 12 54 09 PM

After
Screen Shot 2022-01-19 at 12 55 08 PM

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs and playground toggles
  • Added documentation
  • Checked Code Sandbox works for any docs examples
  • Added or updated jest and cypress tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

cchaos added 24 commits November 1, 2021 15:25
…pdating the other `arrow` icons to a thicker weight
…nation

# Conflicts:
#	CHANGELOG.md
#	src/components/icon/__snapshots__/icon.test.tsx.snap
[Breaking] Changed `hidePerPageOptions` to the positive `showPerPageOptions`
Copy link
Contributor Author

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

This PR is now ready for review while I finish up the PR checklist. 😄

src/components/table/table_pagination/table_pagination.tsx Outdated Show resolved Hide resolved
<EuiFlexGroup
justifyContent="spaceBetween"
alignItems="center"
responsive={false}
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 removed responsive={false} to better ensure that the items wrap on small screens. Still not 100% effective for responsive behavior, but better than getting cutoff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I think I've solved this even better:

Before the layout added scrollbars, but the problem is that this visually prioritizes the "Rows per page" instead of the actual pagination numbers.

Screen Shot 2022-02-15 at 13 32 47 PM

After the layout has wrap on it, so without having to monitor the actual size of the container, if it's too narrow the pagination numbers will just wrap below the "Rows per page" first, then scroll if still necessary

Screen Shot 2022-02-15 at 13 33 23 PMScreen Shot 2022-02-15 at 13 57 25 PM

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5547/

Fix dark mode in guidelines
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5547/

Copy link
Member

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Apologies for the lateness, I planned on finishing reviewing last Friday after my eye exam but then my pupils got dilated and my near vision was shot for a few hours after 🙈 I just have some some super minor type-related feedback, everything else looks great!

@cchaos
Copy link
Contributor Author

cchaos commented Feb 15, 2022

This PR is ready for final review. Thanks so much @constancecchen for addition of the 'all' option. Much clearer intent on how to add this as an option over 0.

@1Copenut I'd love you a11y evaluation over how this affects the overall table screen reader functionality. You can see a full example under the Preserve the user-customized state of pagination section of the guidelines page https://eui.elastic.co/pr_5547/#/navigation/pagination/guidelines

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5547/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5547/

@1Copenut
Copy link
Contributor

@cchaos I took a look at the linked page, and spent a while considering language. I noticed the option 10 rows uses passive voice, where Show all uses active voice. That's not a problem, just an observation. It might be cool to have an accessible label that says "Show all rows" semantically, and retains the same visual label. Where all rows is the outlier(?) that removes pagination behavior, having it use a different voice might be a nice cue that the UI is going to change.

Copy link
Member

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Love the wrap change! This LGTM to me from a code POV, although I have a few small perf suggestions. If you're OK with them I can push up the memoization hooks to this branch, up to you

@cchaos
Copy link
Contributor Author

cchaos commented Feb 16, 2022

If you're OK with them I can push up the memoization hooks to this branch, up to you

Yes please!!! 🙏

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5547/

@cchaos
Copy link
Contributor Author

cchaos commented Feb 18, 2022

@1Copenut Based on Gail's recommendation for the button text and your suggestion for screen-reader text, I've just gone ahead and updated the option's visible text to include the word rows. Having specific SR text for this doesn't seem necessary. Everyone can benefit from the extra/precise language.
Screen Shot 2022-02-18 at 15 49 09 PM

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5547/

Copy link
Contributor

@miukimiu miukimiu left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the issues.

I read the guidelines and tested the changes again. LGTM! 🎉

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

Successfully merging this pull request may close these issues.

7 participants