-
Notifications
You must be signed in to change notification settings - Fork 369
chore: fix types for pagination navigation #10263
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
chore: fix types for pagination navigation #10263
Conversation
Preview: https://patternfly-react-pr-10263.surge.sh A11y report: https://patternfly-react-pr-10263-a11y.surge.sh |
Signed-off-by: Jon Koops <[email protected]>
1a15d04
to
4d23aa0
Compare
@@ -148,7 +148,7 @@ export interface PaginationProps extends React.HTMLProps<HTMLDivElement>, OUIAPr | |||
/** Function called when user clicks on navigate to next page. */ | |||
onNextClick?: (event: React.SyntheticEvent<HTMLButtonElement>, page: number) => void; | |||
/** Function called when user inputs page number. */ | |||
onPageInput?: (event: React.SyntheticEvent<HTMLButtonElement>, page: number) => void; | |||
onPageInput?: (event: React.KeyboardEvent<HTMLInputElement>, page: number) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change to the type of a public API, but the type that was here before was incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Would want someone from patternfly-react team to make the call on whether this needs to go into PF6 due to breaking change, although if it was wrong that might qualify it to get into PF5 anyway.
Discussed this with @tlabaj and we can land this under v5 since it's only a type-correctness fix. |
@@ -29,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: string | number; | |||
page: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm overall but cc @tlabaj to double check that this prop change isn't also a breaking change (while onPageInput
was a type fix).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface is never exported as a public API, so this will not be a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Refactors the types of the pagination navigation so that they will compile when upgrading to TypeScript 5. This is needed to land #10156.