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

[Bug]: Pagination - incorrect display when there are no items #16625

Closed
2 tasks done
a88zach opened this issue May 30, 2024 · 3 comments · Fixed by #16876
Closed
2 tasks done

[Bug]: Pagination - incorrect display when there are no items #16625

a88zach opened this issue May 30, 2024 · 3 comments · Fixed by #16876
Assignees

Comments

@a88zach
Copy link

a88zach commented May 30, 2024

Package

@carbon/react

Browser

Chrome

Package version

1.58.0

React version

18.3.1

Description

Pagination control shows incorrect/invalid messaging when totalItems=0

Currently it shows 1-{pageSize} items for the current page items
Currently it show _ of NaN pages for the current page

Screenshot 2024-05-30 at 3 02 47 PM

Reproduction/example

https://stackblitz.com/edit/github-1ithgj-5v2k2k?file=src%2FApp.tsx

Steps to reproduce

Load the Stackblitz and expand the preview window to a resolution that displays the full control

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

@riddhybansal
Copy link
Contributor

Hi @laurenmrice , I have few questions here should we even display pagination when total items is 0 ? And if yes, what should be the design spec for the same. What messages should we display ??

@tay1orjones
Copy link
Member

should we even display pagination when total items is 0 ?

@riddhybansal Yes, it should be an option to display it even with no items. This way consumers can avoid layout shift by keeping it in the DOM vs removing/re-adding to the DOM.

what should be the design spec

@laurenmrice can confirm, but I think at a base level it should support 0 values for everything, like this from Carbon for IBM Products

Image

I think this component should never render NaN.

@laurenmrice
Copy link
Member

@tay1orjones @riddhybansal Yes, like Taylor said above we can keep the pagination there for now even when the total items is 0. Design has some website guidance discrepancies between our Empty state pattern and the Carbon for IBM Products Empty state component of when to display pagination for empty tables. But the products guidance is more up to date than ours and teams are currently using it this way so I think it is valid to keep it.

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

Successfully merging a pull request may close this issue.

4 participants