carbon: Page selector is not suitable for tables with many pages
Title line template: [Title]: Brief description
The page selector on https://pages.github.ibm.com/security/carbon-addons-security/branch/v2/?path=/story/components-datatablepagination--pagination-data-table component is not suitable for tables with many pages
What package(s) are you using?
-
carbon-components -
carbon-components-react
Detailed description
The page selector on https://pages.github.ibm.com/security/carbon-addons-security/branch/v2/?path=/story/components-datatablepagination--pagination-data-table component that we are using in our app is unsuitable when there are many pages in the table - would it be possible to use a different component?
Expected behavior -
User should be able to enter a number to select the page via, for example, a TextInput or a NumberInput component
Actual behavior -
The control is a Select inside the Pagination component, and when there are many pages the it is displayed outside the confines of the browser page, and user has to scroll up and down to find the required page and then select it. This is not an acceptable User Experience.
Steps to reproduce the issue
- Create around 650 entries in the data table pagination table
- Select 10 items per page
- Click on the page selector and observe it’s behaviour when trying to select a page, say page 60
Affected browsers All browsers, but worse on Chrome (as shown in screenshot)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (16 by maintainers)
@tw15egan Sorry for the delay getting back to you – we are slowly working this out in
@carbon/ibm-security😅The plan is to refactor the
Paginationcomponent to be more like “building blocks”, similar to theUIShellfor example, so that way folks have several options to deal with this issue:PageSelector(i.e., the select element that gets REALLY big when you have a bunch of numbers) at all.sizeattribute to thePageSelectorto reduce the height of the selector (allow you to scroll within it). This was a proposal originally in https://github.com/carbon-design-system/carbon/pull/4378 but the reviewers weren’t fond of it (understandably so, due to the way it looked) – BUT on our end we are at least going to give people this option.Anyway, now the plan is to polish this refactored pagination component – currently called
UNSTABLE__Paginationin our library & then propose it back up to Carbon. It would be a breaking change, for sure.EDIT: our
UNSTABLE__Pagination(work in progress) is here: https://ibm-security.carbondesignsystem.com/?path=/story/components-unstable-pagination--default Again I’m still working on the optional number input. But right now you can leave out the select element, if you want, which would help people dealing with a LOT of pages that creates a performance hit.@asudoh We mentioned a number input solution way back in https://github.com/carbon-design-system/carbon/pull/4378#issuecomment-546019688 and thought a number input would be a good solution for a large number of pages.
Carbon designers haven’t created design specs, @jendowns have you guys already done that for your option 3?
Definitely think Number Input (mobile variant may work best) is the way to go, but also curious how we would handle the error state. Design will need to work that out before we’re able to implement anything, so a draft PR may help to get some eyes on the problem if you have the time 🙏
@jendowns Number input sounds a viable option, if our designers agree. CC @carbon-design-system/design
As #5129 tells, having many
<option>for each page causes the problem not only of the vertical size but also of the performance. My $0.02 is providing an option not to render the<select>, we we haven’t implemented such option.Apologies - you’re right, for some reason the codepen I was using must not have been updating properly as when I was setting size it was still using the dropdown list.
And yes, I do agree that this is not a catch all solution for the large list - that case definitely requires a researched refactor. I just wanted to draw attention in case it influenced a decision on this particular use case (or if documentation could be updated with guidance on the prop that it doesn’t solve the large options problem).