Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/react-core/src/components/Pagination/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-do
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
import AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon';
import { Button, ButtonVariant } from '../Button';
import { TextInput } from '../TextInput';
import { OnSetPage } from './Pagination';
import { pluralize, PickOptional } from '../../helpers';
import { KeyTypes } from '../../helpers/constants';
Expand All @@ -28,7 +29,7 @@ export interface NavigationProps extends React.HTMLProps<HTMLElement> {
/** Label for the English word "of". */
ofWord?: string;
/** The number of the current page. */
page: React.ReactText;
page: string | number;
/** The title of a page displayed beside the page number. */
pagesTitle?: string;
/** The title of a page displayed beside the page number (the plural form). */
Expand Down Expand Up @@ -102,9 +103,9 @@ export class Navigation extends React.Component<NavigationProps, NavigationState
return inputPage;
}

private onChange(event: React.ChangeEvent<HTMLInputElement>, lastPage: number): void {
const inputPage = Navigation.parseInteger(event.target.value, lastPage);
this.setState({ userInputPage: Number.isNaN(inputPage as number) ? event.target.value : inputPage });
private onChange(event: React.FormEvent<HTMLInputElement>, lastPage: number): void {
const inputPage = Navigation.parseInteger(event.currentTarget.value, lastPage);
this.setState({ userInputPage: Number.isNaN(inputPage as number) ? event.currentTarget.value : inputPage });
}

private onKeyDown(
Expand Down Expand Up @@ -217,11 +218,10 @@ export class Navigation extends React.Component<NavigationProps, NavigationState
</div>
{!isCompact && (
<div className={styles.paginationNavPageSelect}>
<input
className={css(styles.formControl)}
<TextInput
Copy link
Contributor

Choose a reason for hiding this comment

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

🥳

aria-label={currPageAriaLabel}
type="number"
disabled={
isDisabled={
isDisabled || (itemCount && page === firstPage && page === lastPage && itemCount >= 0) || page === 0
}
min={lastPage <= 0 && firstPage <= 0 ? 0 : 1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,21 @@ exports[`Navigation should match snapshot (auto-generated) 1`] = `
<div
class="pf-v5-c-pagination__nav-page-select"
>
<input
aria-label="Current page"
<div
class="pf-v5-c-form-control"
max="0"
min="0"
type="number"
value="42"
/>
>
<input
aria-invalid="false"
aria-label="Current page"
data-ouia-component-id="OUIA-Generated-TextInputBase-1"
data-ouia-component-type="PF4/TextInput"
data-ouia-safe="true"
max="0"
min="0"
type="number"
value="42"
/>
</div>
</div>
<div
class="pf-v5-c-pagination__nav-control"
Expand Down
Loading