diff --git a/packages/react-core/src/components/Pagination/Pagination.tsx b/packages/react-core/src/components/Pagination/Pagination.tsx index c531367358e..13171adb983 100644 --- a/packages/react-core/src/components/Pagination/Pagination.tsx +++ b/packages/react-core/src/components/Pagination/Pagination.tsx @@ -210,8 +210,8 @@ export const Pagination: React.FunctionComponent = ({ ofWord: 'of' }, firstPage = 1, - page: pageProp = 0, - offset = 0, + page: pageProp = 1, + offset = null, isLastFullPageShown = false, itemsStart = null, itemsEnd = null, @@ -245,11 +245,8 @@ export const Pagination: React.FunctionComponent = ({ const dropDirection = dropDirectionProp || (variant === 'bottom' && !isStatic ? 'up' : 'down'); let page = pageProp; - if (!page && offset) { - page = Math.ceil(offset / perPage); - } - if (page === 0 && !itemCount) { - page = 1; + if (offset !== null) { + page = Math.max(Math.ceil(offset / perPage), 1); } const lastPage = getLastPage(); diff --git a/packages/react-core/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap b/packages/react-core/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap index b9ba9e31904..857e57778df 100644 --- a/packages/react-core/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +++ b/packages/react-core/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap @@ -1159,7 +1159,7 @@ exports[`Pagination component render custom pagination toggle 1`] = `
- -9 - 10 - 40 - + 1 - 10 - 40 -