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

breaks HTMLElement.focus() preventScroll option #15294

Closed
diminutivesloop opened this issue Mar 2, 2021 · 3 comments
Closed

breaks HTMLElement.focus() preventScroll option #15294

diminutivesloop opened this issue Mar 2, 2021 · 3 comments

Comments

@diminutivesloop
Copy link

Current behavior

When code under test calls HTMLElement.focus() with the preventScroll option set to true, the page under test scrolls the focused element into view.

Desired behavior

HTMLElement.focus() should behave the same whether or not it's called in the context of a Cypress test and preserve the current scroll position when the preventScroll option is set to true.

Test code to reproduce

https://github.com/diminutivesloop/cypress-test-tiny/blob/breaks-preventscroll/cypress/integration/spec.js

Versions

Cypress 6.6.0
Chrome 88.0.4324.190
Windows 10

@brion-fuller
Copy link

I have a similar issue regarding custom elements. If I have an input inside of a custom element and redirect focus to this input (mostly for form support), the user can no longer physically click on the input. Is there a reason to prevent calling the native focus method if available?

@jennifer-shehane
Copy link
Member

The code for this is done, but this has yet to be released. We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 7, 2021

Released in 7.7.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v7.7.0, please open a new issue.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Jul 7, 2021
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jul 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants