Skip to content

Conversation

@ngynmt
Copy link

@ngynmt ngynmt commented Dec 16, 2025

Description

The current pagination component forces users to navigate sequentially through pages, creating poor user experience for large datasets. Users frequently need to access specific pages (e.g., jumping from page 1 to page 50) but must click through each intermediate page, leading to time-consuming navigation for large datasets. This change proposes additional options for user to navigate to a specific page.

How has this been tested?

Added examples of open-ended and closed-ended scenarios under tables pages

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ngynmt ngynmt requested a review from a team as a code owner December 16, 2025 06:20
@ngynmt ngynmt requested review from YueyingLu and removed request for a team December 16, 2025 06:20
@ngynmt ngynmt force-pushed the new-jump-to-page-branch branch from 4a1ead1 to ab579b4 Compare January 5, 2026 23:19
@gethinwebster gethinwebster marked this pull request as draft January 6, 2026 15:36
Copy link
Member

@gethinwebster gethinwebster left a comment

Choose a reason for hiding this comment

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

To update snapshots: npm run build && npx jest -c jest.unit.config.js -u documenter test-util

},
};

const renderMainInput = () => (
Copy link
Member

Choose a reason for hiding this comment

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

const renderMainInput = <WithNativeAttributes....

margin-block-start: calc(awsui.$space-scaled-xs * -1);
}

.inline-label {
Copy link
Member

Choose a reason for hiding this comment

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

move this to mixin so it can be reused between select and input, probably move to https://github.com/cloudscape-design/components/blob/main/src/internal/styles/forms/mixins.scss

};

const defaultI18nStrings: Required<PaginationProps.I18nStrings> = {
jumpToPageLabel: 'Page',
Copy link
Member

Choose a reason for hiding this comment

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

remove hardcoded strings

loading?: boolean;
}

export interface JumpToPageRef {
Copy link
Member

Choose a reason for hiding this comment

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

name Ref

type InternalPaginationProps = PaginationProps & InternalBaseComponentProps;
type InternalPaginationProps = PaginationProps &
InternalBaseComponentProps & {
jumpToPageRef?: React.Ref<PaginationProps.JumpToPageRef>;
Copy link
Member

Choose a reason for hiding this comment

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

use forwardRef on the internal component as well, rather than manually adding it to the props

function handleJumpToPageClick(requestedPageIndex: number) {
if (requestedPageIndex < 1) {
// Out of range lower bound - navigate to first page
setJumpToPageValue('1');
Copy link
Member

Choose a reason for hiding this comment

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

replace these 3 lines with handlePageClick(1)

handlePageClick(requestedPageIndex);
} else {
// Out of range - set error and navigate to last page
setHasError(true);
Copy link
Member

Choose a reason for hiding this comment

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

use handlePageClick here (with additional param for error state)

tableComponentContext.paginationRef.current.openEnd = openEnd;
}

const renderJumpToPageButton = () => {
Copy link
Member

Choose a reason for hiding this comment

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

plain value rather than function

/**
* Returns the error popover for jump to page.
*/
findPopover(): PopoverWrapper | null {
Copy link
Member

Choose a reason for hiding this comment

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

findJumpToPagePopover

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants