Looking at the help on this, it mention to follow the behavior for "Intersect Observability" and provides a link for determining the ratio, Not seeing where we can set it or provide and option to change it. Also it seems when using it, might be a bit buggy, or not really feature complete yet.
I have a grid that let's say is 1200px, running in mobile the width is 400px, (see image) we have one fixed column of 100px, then 7 other columns that will scroll in as needed. While using the scrollIntoViewIfNeeded will scroll the columns say col 3 it seems relative to the view port, not the grid. Searching out the issue it seems others are running into a problem or saying that it isn't working, well might argue it is and isn't. I believe what is happening "col 3" is being scrolled but relative to the viewport, fair enough, but in my case the frozen column is there and "col 3" is yet obstructed.
Might think it might be beyond the scope of the scrolIntoViewIfNeeded to let itself to determine this. And would purpose a couple overloads to allow a locator for the parent containing and use it's bounding box, or a bounding rectangle that would be where to scroll the element into...
This thread is trying to answer question "How can I set or change the 'Intersect Observability' ratio for the 'scrollIntoViewIfNeeded' function, and how can I make it scroll relative to the grid, not the viewport?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email firstname.lastname@example.org.