-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Click Action is not resolving on Web Components with Slot Content #30019
Comments
Okay, digging deeper here, I was able to put a breakpoint in the I noticed that On Chrome, for For For On Firefox, the first two examples behave the same way as chrome, however the last example instead has The full set of results is the following:
|
Okay, digging even further here, this looks like this might be an issue related to If this is the case, there is potentially a behavior / spec inconsistency to debug. I'm going to try building a codepen to validate if that is the case, and if-so, can start working on a web-platform test to highlight the browser inconsistency. IF that is the case, we can potentially close this out - it's potentially possible that cypress could code around this, but makes more sense to have the browser implementers work towards making this more consistent. |
Update: this is in-fact caused by an inconsistency in the behavior of
|
This appears to be the same issue as listed here: #19260 In that listed issue there is a work-around, as well as a link to the web platform feature to be resolved. |
@JRJurman Thanks for taking the time to investigate further |
Current behavior
When using native Web Components, if a component has slot content of a specific size (e.g. 3 characters), click event listeners don't appear to trigger when using
cy.click
. They will trigger if there are fewer characters, or none at all (defaulting to the existing slot content).All the behavior was validated using this minimal example repo
The bug can be observed in the following browsers (on macOS):
In the above image, we have two buttons, the first one says
Counter: 1
, and the second one saysTesting: 0
. The first one saysCounter
because that is the default text to show when there is no slot content. The second one saysTesting
because we passed in that text in the slot. The code looks like the following:The first one says
1
because it was successfully clicked on, and the event listener on the button triggered. The second button however still says0
, an unexpected failure.NOTE: if there are only a few characters in the slot content, then this does appear to work as expected:
In the above image, we've replaced the
Testing
in the second control with the letterT
. This appears to make the test pass successfully.It does not appear to happen in the following browsers (on macOS):
In the above image, we see both buttons have say
1
, indicating that the event listeners triggered correctly.Note, regardless of browser, clicking on the elements manually in the cypress window does trigger the click handler.
Desired behavior
We would expect in all browsers that regardless of the slot content size, the click handler should trigger when calling
cy.click
(either on the host element, or an element in the shadow root).Test code to reproduce
Minimal Reproduction Project with failing tests: https://github.com/JRJurman/cypress-shadow-root-target-minimal-reproduction
Cypress Version
13.13.2
Node version
v19.6.1
Operating System
macOS 14.6.1
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: