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.

position sticky and flex, cypress scrolls to the end of page to access element

See original GitHub issue
  • Operating System: macOS High Sierra 10.13.3
  • Cypress Version: 2.1.0
  • Browser Version: Chrome 59

Is this a Feature or Bug?

Bug

Current behavior:

When using position: sticky and display: flex combination cypress gets mad when trying to access element inside sticky element:

cy-bug

It scrolls to the end of the page before performing any operations on the element while it is not required as the element is visible and accessible.

Desired behavior:

Should access elements without scrolling

How to reproduce:

https://github.com/RomanGotsiy/cypress-test-tiny

Just run npm run cypress:open and select the only available suite. There are three tests there:

  • type into the input
  • click on the link
  • both but with {force: true} which works as expected

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
brian-manncommented, Jun 29, 2018

Released in 3.0.2.

1reaction
OrganicCatcommented, Mar 26, 2018

I have a similar issue. I’m using Kendo Grid and the dropdowns are generated and then fixed to the element you clicked.

Cypress scrolls down to the bottom of my page, even though the area to be typed in is visible at the top.

A SECONDARY issue is that when coupled with .type() this SOMETIMES makes the dropdown vanish, making every test thereafter fail. This behavior is inconsistent and frustrating, because sometimes the scrolling will decide to close the dropdown and sometimes not.

This makes testing custom dropdowns in Kendo Grid almost impossible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Position Sticky Tutorial With Examples[Complete Guide]
The CSS position sticky element toggles between these two positions depending on the scroll of the page. So, a CSS position sticky element...
Read more >
Interacting with Elements - Cypress Documentation
Scroll the page if still covered by an element with fixed position. Fire the event at the desired coordinates.
Read more >
sticky element do not 'stick' to viewport's top on cypress browser
When run on cypress browser, the element being scrolled out of the view port. my-component.style.ts:` :host { position: -webkit-sticky; ...
Read more >
How To Make Elements Stick with CSS position: sticky
A quick guide on how to use the position: sticky property in CSS to make elements become sticky when the page is scrolled...
Read more >
Scroll an element into the center of the viewport - Hidde's blog
This isn't always ideal, sometimes you may have a sticky header, so scrollling an element to the top of the document would not...
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