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

fix: make isFocusedOrInFocused check shadow roots #26207

Merged

Conversation

kgroat
Copy link
Contributor

@kgroat kgroat commented Mar 24, 2023

Additional details

Currently, checking for focus doesn't look inside of shadow roots. This causes issues such as the type command always firing the click even if the element has focus.

This PR changes the behavior of isFocusedOrInFocused to check if the element passed in is an activeElement inside of a shadow root.

Steps to test

Clone https://github.com/kgroat/cypress-type-repro and run the component test. Before these changes, it fails, but after it passes.

How has the user experience changed?

N/A

PR Tasks

@CLAassistant
Copy link

CLAassistant commented Mar 24, 2023

CLA assistant check
All committers have signed the CLA.

@kgroat kgroat changed the title fix(driver) make isFocusedOrInFocused check shadow roots fix: make isFocusedOrInFocused check shadow roots Mar 24, 2023
@kgroat kgroat force-pushed the issue-26198-check-shadow-roots-for-focus branch from bc8e4a4 to 8d7622d Compare March 24, 2023 01:43
@kgroat kgroat marked this pull request as ready for review March 24, 2023 02:21
@cypress
Copy link

cypress bot commented Mar 24, 2023

1 failed and 30 flaky tests on run #44937 ↗︎

1 26894 1281 0 Flakiness 30

Details:

Add e2e test for new scenario
Project: cypress Commit: 0b6bbe8484
Status: Failed Duration: 18:26 💡
Started: Mar 24, 2023 2:31 AM Ended: Mar 24, 2023 2:50 AM
Failed  src/debug/DebugSpec.cy.tsx • 1 failed test • app-ct

View Output Video

Test Artifacts
with multiple test results > mounts correctly for single groups Output Video
Flakiness  create-from-component.cy.ts • 1 flaky test • app-e2e

View Output Video

Test Artifacts
... > runs generated spec Output Screenshots Video
Flakiness  specs_list_latest_runs.cy.ts • 1 flaky test • app-e2e

View Output Video

Test Artifacts
App/Cloud Integration - Latest runs and Average duration > when no runs are recorded > shows placeholders for all visible specs Output Screenshots Video
Flakiness  cypress-in-cypress-component.cy.ts • 1 flaky test • app-e2e

View Output Video

Test Artifacts
Cypress In Cypress CT > default config > redirects to the specs list with error if a spec is not found Output Screenshots Video
Flakiness  cypress-origin-communicator.cy.ts • 1 flaky test • app-e2e

View Output Video

Test Artifacts
Cypress In Cypress Origin Communicator > cy.origin passivity with app interactions > passes upon test reload mid test execution Output Screenshots Video
Flakiness  commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-firefox

View Output Video

Test Artifacts
network stubbing > intercepting request > can delay and throttle a StaticResponse Output

The first 5 flaky specs are shown, see all 18 specs in Cypress Cloud.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@kgroat
Copy link
Contributor Author

kgroat commented Mar 24, 2023

@lmiller1990 I see that there are several errors from the checks running. Are they blocking review? If so, I don't see how they're caused by my code change. What do I need to do to resolve them?

cli/CHANGELOG.md Outdated Show resolved Hide resolved
@kgroat kgroat requested review from emilyrohrbough and removed request for lmiller1990 March 24, 2023 20:25
@kgroat
Copy link
Contributor Author

kgroat commented Mar 24, 2023

Oh, I clicked the "re-request review" button and it removed @lmiller1990 as a reviewer -- not sure why that happened; I'll make sure not to click that button again 😅

@kgroat kgroat force-pushed the issue-26198-check-shadow-roots-for-focus branch from 42de3a9 to 27bfdc9 Compare March 24, 2023 21:08
@chrisbreiding chrisbreiding self-requested a review March 25, 2023 01:16
@lmiller1990 lmiller1990 self-assigned this Mar 26, 2023
cli/CHANGELOG.md Outdated Show resolved Hide resolved
@kgroat
Copy link
Contributor Author

kgroat commented Mar 28, 2023

Is there any chance of this getting merged before the release planned tomorrow?

@lmiller1990
Copy link
Contributor

lmiller1990 commented Mar 28, 2023

Two approvals, CI green, let's ship it! Thanks for the contribution 🎉

@lmiller1990 lmiller1990 merged commit 5611951 into cypress-io:develop Mar 28, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The type command should not click on focused elements inside of shadow roots.
5 participants