-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 shows redundant information when pagesUnknown
is set to true.
#12252
Comments
According to carbon-design-system#12252, when pagesUnknown is , pagination render page number as same as selector which does not make sense to render this information twice. So, I change page number (pageText) to page label in front of the selector which makes more sense and make pagination looks cleaner. BREAKING CHANGE: typeof pageText change from function to string.
Also posted in #12302 I think this can be fixed just by passing down .#{$prefix}--pagination__right .#{$prefix}--pagination__text:empty {
margin: 0;
} |
If we still want to keep the pageText = (page) => {
return `page ${pagesUnknown ? '' : page}`;
}, We would then add two opposite ternary renders inside Before the {pagesUnknown ? null : (
<span className={`${prefix}--pagination__text`}>
{pagesUnknown ? pageText(page) : pageRangeText(page, totalPages)}
</span>
)} After the {pagesUnknown ? (
<span className={`${prefix}--pagination__text`}>
{pagesUnknown ? pageText(page) : pageRangeText(page, totalPages)}
</span>
) : null} Would probably need to do some style adjustments as well to get the text inside of the border instead of outside to the left |
Add two opposite ternary renders inside About border, I already moved However, would be better if we use |
Like this. {pagesUnknown ? (
<label
id={`${prefix}-pagination-select-${inputId}-right-label`}
className={`${prefix}--pagination__text ${prefix}--pagination__page-text`}
htmlFor={`${prefix}-pagination-select-${inputId}-right`}>
{pagesUnknown ? pageText(page) : pageRangeText(page, totalPages)}
</label>
) : null} Just wonder. If you prefer |
@61130061 I believe we already have a hidden label for the Your examples look great 👍🏻 |
@tw15egan All done! Thanks for your suggestions. 🙏🏻 |
I'm confused. How do you populate the items in the |
…12302) * fix(react/pagination): change style of pageText when pagesUnknown is According to #12252, when pagesUnknown is , pagination render page number as same as selector which does not make sense to render this information twice. So, I change page number (pageText) to page label in front of the selector which makes more sense and make pagination looks cleaner. BREAKING CHANGE: typeof pageText change from function to string. * fix(react/pagination): render page number twice modified * Update packages/react/src/components/Pagination/next/Pagination.js Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com> * fix(react/pagination): resolve another conflict on /Pagination.js * chore: fix deleted files Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com> Co-authored-by: Taylor Jones <taylor.jones826@gmail.com> Co-authored-by: TJ Egan <tw15egan@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Package
@carbon/react, carbon-components-react
Browser
Chrome, Firefox, Edge
Package version
v1.14
Description
In pagination component, when
pagesUnknown
prop has been set totrue
, the page number is shown twice.e.g.
1 page 1
If I change the page number via
select
, the page number also updates as such:2 page 2
3 page 3
...etc,
The first number is the page option selected from the select element. Then the same information is repeated in the following text.
Shouldn't it just be
Page <select element with number>
[TEXT (SELECT ELEMENT)]? Is there a reason for repeating the page number?I'm not sure if this counts as a design defect, but this issue was raised in Carbon Angular, just forwarding it here so we know what steps to take.
Screenshots
Steps to reproduce
Go to the following storybook (props have been already set, so no changes required):
https://react.carbondesignsystem.com/?path=/story/components-pagination--default&args=pagesUnknown:true
Code of Conduct
The text was updated successfully, but these errors were encountered: