You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The onClick prop typing for the Button component is missing the MouseEvent
Expected behavior
The onClick prop's type definition should include React.MouseEvent<HTMLButtonElement> as an argument to the callback function. This is standard and expected behavior for event handlers in React.
The expected type should be: onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;.
Actual behavior
Currently, the type definition for the onClick prop on the Button component does not provide the MouseEvent object to the handler function. The type is likely defined as onClick?: () => unknown;.
This prevents developers from accessing standard event properties and methods like event.preventDefault(), event.stopPropagation(), or `
Summary
The
onClickprop typing for theButtoncomponent is missing theMouseEventExpected behavior
The
onClickprop's type definition should includeReact.MouseEvent<HTMLButtonElement>as an argument to the callback function. This is standard and expected behavior for event handlers in React.The expected type should be:
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;.Actual behavior
Currently, the type definition for the
onClickprop on theButtoncomponent does not provide theMouseEventobject to the handler function. The type is likely defined asonClick?: () => unknown;.This prevents developers from accessing standard event properties and methods like
event.preventDefault(),event.stopPropagation(), or ``.
Steps to reproduce
Link to sandbox
Buttoncomponent in a TypeScript project.onClickprop.eventobject within the handler.eventparameter is not defined in the function's signature.Are you using React components?
Yes
Polaris version number
^13.5.0
Browser
Chrome Version 139.0.7258.128
Device
Macbook Air M2