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

[Feature Request]: Add disableOverflow option to PaginationNav to support high page counts #15014

Closed
1 task done
radarfox opened this issue Oct 25, 2023 · 6 comments · Fixed by #15219
Closed
1 task done
Labels
afrohacks See https://ibm.biz/afrohacks-hackathon good first issue 👋 Used by GitHub to elevate contribution opportunities hacktoberfest See https://hacktoberfest.com/ needs: community contribution Due to roadmap and resource availability, we are looking for outside contributions on this issue. proposal: accepted This request has gone through triaging and we are accepting PR's against it. status: help wanted 👐 type: enhancement 💡

Comments

@radarfox
Copy link

The problem

We would like to migrate from our custom pagination component to PaginationNav. We have the publications catalogue, that has over 1600 pages. Our custom component has no problems navigating it, but as I'm trying the PaginationNav playground, it looks like it tends to freeze the browser just for thousands of pages. I'm using Chrome 118.

The solution

I'm not sure where exactly the problem is, so it's complicated to propose something. I suppose the problem might by in the select associated with "..." button. It lists thousands of items, which is a bit hard to navigate for the user. So, maybe allow to disable the select to prevent this? Or limit the select to some finite number of items? Maybe something like this:

<PaginationNav maxSelectItems={10} />

Examples

https://research.ibm.com/publications

Application/PAL

https://research.ibm.com/

Business priority

Medium Priority = upcoming release but is not pressing

Available extra resources

No response

Code of Conduct

@github-actions
Copy link
Contributor

Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team.

If your proposal is accepted and the Carbon team has bandwidth they will take on the issue, or else request you or other volunteers from the community to work on this issue.

@tay1orjones
Copy link
Member

The performance issue is probably related to this bit of the code and could be rewritten to be more optimized for high page counts:

{
// render items between overflows
[...Array(totalItems)]
.map((e, i) => i)
.slice(startOffset + cuts.front, (1 + cuts.back) * -1)
.map((item) => (
<PaginationItem
key={`item-${item}`}
page={item + 1}
translateWithId={t}
isActive={currentPage === item}
onClick={() => {
jumpToItem(item);
}}
/>
))
}

Also note that Chrome limits the total amount of options inside a select to 10000

@sstrubberg
Copy link
Member

Connected to the UX in #15012

@tay1orjones
Copy link
Member

tay1orjones commented Oct 30, 2023

Have you seen a valid use case for jumping to a middle page within the overflow select when you have that many (10000+) pages? I ask because one option to eliminate this issue would be to add a new prop to disable the overflow at high page counts, like GitHub does:
image

The ... is not operable in that screenshot.

@radarfox
Copy link
Author

@tay1orjones I have mentioned that problem in the issue description:

I suppose the problem might by in the select associated with "..." button. It lists thousands of items, which is a bit hard to navigate for the user. So, maybe allow to disable the select to prevent this? Or limit the select to some finite number of items?

If you would add a new property like maxSelectItems?: number or disableSelect?: boolean it would solve the problem for us.

@tay1orjones
Copy link
Member

@radarfox Yep, we just discussed as a team and agree, adding a disableOverflow prop to allow disabling the overflow (select) is a good option. It should still render the three dots ..., but not be operable.

This will fall lower on our list of priorities so we may not be able to get to it in a timely fashion. If you're keen to contribute this enhancement, we'd so appreciate it! I'm happy to answer any questions to help get you started on a PR, just let me know.

@tay1orjones tay1orjones added status: help wanted 👐 good first issue 👋 Used by GitHub to elevate contribution opportunities proposal: accepted This request has gone through triaging and we are accepting PR's against it. hacktoberfest See https://hacktoberfest.com/ needs: community contribution Due to roadmap and resource availability, we are looking for outside contributions on this issue. afrohacks See https://ibm.biz/afrohacks-hackathon labels Nov 13, 2023
@tay1orjones tay1orjones moved this from Icebox to Ready for community implementation in Roadmap Nov 13, 2023
@tay1orjones tay1orjones changed the title [Feature Request]: Support many pages in PaginationNav [Feature Request]: Add disableOverflow option to PaginationNav to support high page counts Nov 13, 2023
@carbon-design-system carbon-design-system deleted a comment from github-actions bot Nov 13, 2023
@github-project-automation github-project-automation bot moved this from Ready for community implementation to Completed in Roadmap Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
afrohacks See https://ibm.biz/afrohacks-hackathon good first issue 👋 Used by GitHub to elevate contribution opportunities hacktoberfest See https://hacktoberfest.com/ needs: community contribution Due to roadmap and resource availability, we are looking for outside contributions on this issue. proposal: accepted This request has gone through triaging and we are accepting PR's against it. status: help wanted 👐 type: enhancement 💡
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants