Skip to content

fix(ObjectStatus): remove HTMLDivElement from onClick type #6011

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

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/main/src/components/ObjectStatus/index.tsx
Original file line number Diff line number Diff line change
@@ -100,11 +100,9 @@ export interface ObjectStatusPropTypes extends CommonProps {
*
* __Note:__ This prop has no effect if `active` is not set to `true`.
*
* __Note:__ In order to support legacy code, `HTMLDivElement` is still supported even though the `click` event is never fired if the component isn't `active`.
*
* @since 0.16.6
*/
onClick?: MouseEventHandler<HTMLButtonElement | HTMLDivElement>;
onClick?: MouseEventHandler<HTMLButtonElement>;
}

const getStateSpecifics = (state, showDefaultIcon, userIcon, stateAnnouncementText, i18nTexts) => {
@@ -223,6 +221,7 @@ const ObjectStatus = forwardRef<HTMLDivElement | HTMLButtonElement, ObjectStatus
ref={ref}
className={objStatusClasses}
style={style}
// @ts-expect-error: onClick is only registered if the event target is a HTMLButtonElement
onClick={active ? onClick : undefined}
tabIndex={active ? 0 : undefined}
data-icon-only={!children}
Loading