Skip to content
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

fix(Pagination): ignore clicks if pagination button is disabled #1415

Merged

Conversation

andreww2012
Copy link
Contributor

Pagination buttons (like prev/next) can become any HTML element, for example <a>, which, unlike <button>, doesn't support disabled attribute and still emits click events.

If a pagination button component is considered disabled, but rendered as a non-button HTML element, clicking it may update the component's state in a bad way (for example, set the current page to 0 after clicking the "<" button when being on the first page).

This PR adds !disabled && conditions to all pagination buttons components' click event handlers.

Copy link
Member

@zernonia zernonia left a comment

Choose a reason for hiding this comment

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

Nicely done @andreww2012 !!

Thanks for adding the test case too! 🚀

@zernonia zernonia merged commit fdb13b1 into unovue:main Nov 7, 2024
3 checks passed
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