question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Regression] Element actionability fails because it is scrolled behind another element.

See original GitHub issue

Current behavior

After upgrading to Cypress 6.8.0, we are experiencing test failures as a result of elements not being able to be clicked due to being covered by another element. It seems likely that this is a regression related to changes made for #3200 .

Desired behavior

Tests pass exactly as they did in our prior Cypress version, 6.6.0.

Test code to reproduce

context('Cypress Issue', function () {

  beforeEach(function () {

    // These are not real credentials.
    // Please sign up (for free) at www.vidyard.com, verify your email address, then update these accordingly.

    const email = 'fake@email.com'
    const password = 'yourPassword'

    cy.visit('https://secure.vidyard.com/user/sign_in')
    cy.get('#username').type(email)
    cy.get('#password').type(password)
    cy.get('#sign-in').click()
    cy.wait(5000) // Just to make sure the page is fully loaded.
  })

  it('Click Issue caused by Visibility', function () {
    cy.get('[data-testid=folder-navigation]')
      .click();
  });
});

Fails in Cypress version 6.8.0.

image

Passes in Cypress version 6.6.0.

image

Additional Notes

It looks like adding the workaround proposed to avoid issue #3200 actually works around this problem too, but (at least in the case of my application) this is a worse experience because we have to use the workaround everywhere and not just in certain places as had previously been the case. 😞

    cy.document().then((document) => {
      const node = document.createElement('style');
      node.innerHTML = 'html { scroll-behavior: auto !important; }';
      document.body.appendChild(node);
    });

Versions

Cypress version 6.8.0 on macOS in Chrome 89 and Firefox 86.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
trev125commented, May 7, 2021

@todd-m-kemp Thank you for adding that work around! That seems to have fixed things for me temporarily, and it was such a weird thing to see.

2reactions
todd-m-kempcommented, Apr 16, 2021

@jennifer-shehane suggested in an earlier comment that I look into the scrollBehavior option on click but initially I wasn’t terribly interested since I didn’t want to have to explicitly provide this option on all calls to click because this was a very broad problem causing failures in nearly every test of ours. However, yesterday I stumbled across the scrollBehavior option in cypress.json where you can set it globally. I did so, and this problem doesn’t seem to occur in our test runs when using center as the scrollBehavior setting. Those of you experiencing this problem may also want to give that a try.

Read more comments on GitHub >

github_iconTop Results From Across the Web

element is being covered by another element cypress - You.com
Every time when the command starts executing, page scroll down so the required element is not visible and it's hidden under the menu...
Read more >
allow scroll of div set behind another div - Stack Overflow
First at all I would position the image of the ipad at the background with position:fixed and negative z-index . Now we have...
Read more >
Changelog - Cypress Documentation
Interacting with an element that requires scrolling within an element with scroll-behavior: smooth no longer fails Cypress's actionability check.
Read more >
overscroll-behavior - CSS: Cascading Style Sheets | MDN
Default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll ......
Read more >
What is A/B Testing? A Practical Guide With Examples | VWO
With A/B testing, this problem can be solved once and for all. ... Another element of your website that you can optimize by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found