okp4 / ui

🎨 Implementation of OKP4 UI components in React, TypeScript, and SASS.
https://ui.okp4.space/
BSD 3-Clause "New" or "Revised" License
28 stars 2 forks source link

Button's `onClick` property must pass optional event parameter #615

Closed fredericvilcot closed 1 year ago

fredericvilcot commented 2 years ago

Bug report

Describe the bug

When using the Button component, we could want to access the event parameter (e.g to prevent the default behavior or to stop the event propagation).

But, the property signature does not explicitly declare it:

readonly onClick?: () => void

Expected behavior

We should access the event parameter in the onClick callback function.

readonly onClick?: (event?: React.MouseEvent<HTMLButtonElement>) => void