unovue / radix-vue

Vue port of Radix UI Primitives. An open-source UI component library for building high-quality, accessible design systems and web apps.
https://radix-vue.com
MIT License
3.69k stars 228 forks source link

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

Closed andreww2012 closed 2 weeks ago

andreww2012 commented 2 weeks ago

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.