Skip to content

Commit

Permalink
FIXUP conditional scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpitt committed Aug 19, 2024
1 parent a0841e2 commit a5de094
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/common/test-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ window.ph_find = function(sel) {

window.ph_find_scroll_into_view = function(sel) {
const el = window.ph_find(sel);
return el;
/*
return new Promise(resolve => {
// is the element already visible? if so, we are done
const bounds = el.getBoundingClientRect();
if (bounds.top >= 0 && bounds.bottom <= window.innerHeight)
resolve(el);

// Otherwise, scroll it into view. That needs a little bit of time to stabilize, and
// it's not predictable; in particular, 'scrollend' is not reliably emitted
el.scrollIntoView({ behaviour: 'instant', block: 'center', inline: 'center' });
// scrolling needs a little bit of time to stabilize, and it's not predictable
// in particular, 'scrollend' is not reliably emitted
window.setTimeout(() => resolve(el), 200);
});
*/
};

window.ph_count = function(sel) {
Expand Down

0 comments on commit a5de094

Please sign in to comment.