Skip to content
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

Disabled button with span inside triggers click event #2902

Closed
Bamyan opened this issue Sep 26, 2018 · 6 comments
Closed

Disabled button with span inside triggers click event #2902

Bamyan opened this issue Sep 26, 2018 · 6 comments
Assignees
Labels
AREA: client STATE: Auto-locked An issue has been automatically locked by the Lock bot. STATE: Duplicate An issues has been already reported in the other thread. SYSTEM: automations TYPE: bug The described behavior is considered as wrong (bug).
Milestone

Comments

@Bamyan
Copy link

Bamyan commented Sep 26, 2018

Are you requesting a feature or reporting a bug?

Bug.

What is the current behavior?

When you have disabled native button with span element inside, the click event is triggered in IE and Edge browsers.

What is the expected behavior?

Click event should not be triggered when a button is disabled.

How would you reproduce the current behavior (if this is a bug)?

  1. Create a disabled button with span element inside. Bind to the click event.
  2. Try to click it in IE/Edge browser.

Provide the test code and the tested page URL (if applicable)

<button disabled onclick="myFunction()">Click me</button>

<p id="demo"></p>

<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}
</script>

Specify your

  • operating system: Win7 - IE, Win10 - Edge
  • testcafe version: 0.20.1
  • node.js version: 8.9.4
@AlexKamaev
Copy link
Contributor

I was able to reproduce the issue in Edge

@AlexKamaev
Copy link
Contributor

fixed in DevExpress/testcafe-hammerhead#1880

@palpatine1991
Copy link

palpatine1991 commented Feb 15, 2019

@AlexKamaev I am not sure if this fix is correct. Let me show you the example:

In the very simple case your fix is correct. No console log is called when the button is clicked (and it behaves the same in TestCafe):

<!-- Won't log anything -->
<div onclick="console.log('div')">
	<button disabled onclick="console.log('button')">
    	   Click me
  	</button>
</div>

On the other hand, when the disabled button contains any other element, the click events are called (but not in TestCafe!):

<!-- Logs "span" "div" -->
<div onclick="console.log('div')">
	<button  onclick="console.log('button')">
    	<span onclick="console.log('span')">Click me</span>
  	</button>
</div>

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Feb 15, 2019
@AlexKamaev
Copy link
Contributor

@palpatine1991
Thanks for the information. I see the inconsistency in this behavior. I'll reopen the issue.

@AlexKamaev AlexKamaev reopened this Feb 18, 2019
@AlexKamaev AlexKamaev removed the STATE: Need response An issue that requires a response or attention from the team. label Feb 18, 2019
@AlexKamaev AlexKamaev modified the milestones: Sprint #24, Planned Feb 18, 2019
@AlexKamaev
Copy link
Contributor

I'll mark this issue as a duplicate since we have similar issue in the testcafe-hammerhead repository: #6949.
 

@lock
Copy link

lock bot commented Apr 26, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label Apr 26, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AREA: client STATE: Auto-locked An issue has been automatically locked by the Lock bot. STATE: Duplicate An issues has been already reported in the other thread. SYSTEM: automations TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

4 participants