Skip to content

Commit 671cfaa

Browse files
fix(ObjectStatus): remove HTMLDivElement from onClick type (#6011)
BREAKING CHANGE: **TypeScript**: the `HTMLDivElement` type has been removed from the `onClick` handler. --------- Co-authored-by: Lukas Harbarth <[email protected]>
1 parent 9f28276 commit 671cfaa

File tree

1 file changed

+2
-3
lines changed
  • packages/main/src/components/ObjectStatus

1 file changed

+2
-3
lines changed

packages/main/src/components/ObjectStatus/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,9 @@ export interface ObjectStatusPropTypes extends CommonProps {
100100
*
101101
* __Note:__ This prop has no effect if `active` is not set to `true`.
102102
*
103-
* __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`.
104-
*
105103
* @since 0.16.6
106104
*/
107-
onClick?: MouseEventHandler<HTMLButtonElement | HTMLDivElement>;
105+
onClick?: MouseEventHandler<HTMLButtonElement>;
108106
}
109107

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

0 commit comments

Comments
 (0)