You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Performing a click on an <a> that has the disabled attribute does not wait for the disabled attribute to be removed, rather it immediately performs the click successfully.
Desired behavior
The Cypress documentation says :
Cypress checks whether an element's disabled property is true.
...therefore it could be perfectly valid to say that Cypress is behaving correctly as <a> should not be able to be disabled.
Why do I want <a> to respect disabled?
The application I am running Cypress against uses <a> with styling to represent buttons, and itself then uses disabled attribute to prevent the user from clicking button through bespoke mechanisms.
It would be great for me personally for Cypress to work as per documentation and check for disabled for ALL elements.
However, I completely understand that this is non-compliant HTML and therefore should be not expected to work.
If the decision is that this is expected behavior, then I would suggest that documentation is updated to make it clear that the disabled attribute is only checked where it is W3C supported
Test code to reproduce
describe("Clicking on a disabled link",()=>{beforeEach(()=>{cy.intercept("home",{statusCode: 200,fixture: "disabledLinkExample.html",});});it("this test should fail",()=>{cy.visit("home");cy.get("#disabledLink").click();});});
Thanks for reporting this, we will update the documentation - since the disabled attribute on a link element does not prevent users from clicking the element, it would incorrect for Cypress to behave differently.
Current behavior
Performing a click on an
<a>
that has thedisabled
attribute does not wait for thedisabled
attribute to be removed, rather it immediately performs the click successfully.Desired behavior
The Cypress documentation says :
Cypress checks whether an element's disabled property is true.
(https://docs.cypress.io/guides/core-concepts/interacting-with-elements#Disability)
It makes no reference to what the element type is, but rather to the event; in this case
click()
which is explicitly covered.Therefore, this would initially appear to be a clear bug in Cypress.
However.......
W3C says that
disabled
is only supported for a subset of elements (https://www.w3schools.com/tags/att_disabled.asp)...therefore it could be perfectly valid to say that Cypress is behaving correctly as
<a>
should not be able to bedisabled
.Why do I want
<a>
to respectdisabled
?The application I am running Cypress against uses
<a>
with styling to represent buttons, and itself then usesdisabled
attribute to prevent the user from clicking button through bespoke mechanisms.It would be great for me personally for Cypress to work as per documentation and check for
disabled
for ALL elements.However, I completely understand that this is non-compliant HTML and therefore should be not expected to work.
If the decision is that this is expected behavior, then I would suggest that documentation is updated to make it clear that the
disabled
attribute is only checked where it is W3C supportedTest code to reproduce
...where
disabledLinkExample.html
is:Cypress Version
12.3.0
Node version
16.3.1
Operating System
macOSX
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: