Skip to content

Commit

Permalink
fix: composeEventHandlers
Browse files Browse the repository at this point in the history
  • Loading branch information
teleskop150750 committed Sep 22, 2024
1 parent e3a53a4 commit a26125e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vue-primitives/src/shared/composeEventHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ export function composeEventHandlers<E extends Event>(
{ checkForDefaultPrevented = true } = {},
) {
return function handleEvent(event: E) {
const currentTarget = event.currentTarget as HTMLButtonElement
if (currentTarget.disabled || currentTarget.hasAttribute('data-disabled')) {
const currentTarget = event.currentTarget as HTMLButtonElement | null
if (currentTarget && (currentTarget.disabled || currentTarget.hasAttribute('data-disabled'))) {
return
}

const target = event.target as HTMLButtonElement
if (target.disabled || target.hasAttribute('data-disabled')) {
const target = event.target as HTMLButtonElement | null
if (target && (target.disabled || target.hasAttribute('data-disabled'))) {
return
}

Expand Down

0 comments on commit a26125e

Please sign in to comment.