Skip to content

Commit

Permalink
fixes cypress-io#28788 -- mouse.ts logic
Browse files Browse the repository at this point in the history
If mouseUp element or mouseDown element or commonAncestor element is :disabled, click event should be prevented
  • Loading branch information
TheoAnastasiadis committed Jan 26, 2024
1 parent f741635 commit 0bb361b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/driver/src/cy/mouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,11 @@ export const create = (state: StateFunc, keyboard: Keyboard, focused: IFocused,
mouseDownPhase.targetEl &&
$elements.getFirstCommonAncestor(mouseUpPhase.targetEl, mouseDownPhase.targetEl)

// Only send click event if element is not disabled.
if ($elements.isDisabled(commonAncestor)) {
return { skipClickEventReason: 'element was disabled' }
}

return { elToClick: commonAncestor }
}

Expand Down

0 comments on commit 0bb361b

Please sign in to comment.