A screen with a `next` loads its next page itself as its foot comes within a screen of view, as HUDKit's and the Android kit's lists do: one page at a time, on the screen in front alone, stopping at an error until Try again, and never where the browser asks to save data. Its Load more button stays, for the keyboard, screen readers and pages drawn with no script. `LoadMore` takes `auto` for a host to page so.
/** Whether a level is in front and settled, so its list pages as it is scrolled to its foot: the sheet's while one is open, else the stack's top with no pager over it, in the tab on show, and not drawn as it was while its call is made again (refreshing, or swapped for another). */
/** Make a level's call (opening its form the first time, where it does), and draw what it answers in it, while it is still on the stack (or the sheet) drawing that call; past `SKELETON_DELAY`, it is `slow`, unless it draws its last tree meanwhile. */
for (const said of warned) problems.push(`a screen pushed and gone back from: ${said}`);
say('a screen pushed and gone back from: focus moved into it and back, the screen under was inert, its pictures loading late warned nothing');
// A long feed pages itself as its foot comes within a screen of view, once a page, and never while a screen is over it or after a
// page failed, until Try again is pressed. The browser's IntersectionObserver a fake here, its foot shown when the test says.
{
const watching = new Set();
const Observer = globalThis.IntersectionObserver;
globalThis.IntersectionObserver = class {
constructor(seen, options) {
Object.assign(this, { seen, options, watched: new Set() });
}
observe(element) {
this.watched.add(element);
watching.add(this);
}
unobserve(element) {
this.watched.delete(element);
}
disconnect() {
this.watched.clear();
watching.delete(this);
}
takeRecords() {
return [];
}
};
/** The feed's foot, scrolled within a screen of view: each observer watching it told so. */
const footShown = () => {
for (const observer of [...watching])
for (const element of [...observer.watched]) if (element.classList.contains('more')) observer.seen([{ target: element, isIntersecting: true }], observer);
if (!watcher || !/100%/.test(watcher.options.rootMargin)) problems.push(`the long feed's foot is watched ${watcher ? `with the margin ${watcher.options.rootMargin}` : 'by nothing'}, not a screen ahead`);
footShown();
footShown();
await until(() => drawn('Item 1.4'), 'its second page, as its foot came into view');
await settle();
if (pages(1) !== 1) problems.push(`its foot shown twice, the long feed asked for its second page ${pages(1)} times, not once`);
await until(() => levels() === 3, 'their post opened over the long feed');
await settle();
footShown();
await settle();
if (pages(2)) problems.push('under their post, inert, the long feed asked for its third page');
history.go(-1);
await until(() => levels() === 2 && !target.querySelector('.stack:not([hidden]) > section.level[aria-busy="true"]'), 'back at the long feed');
await settle();
pagesFail = true;
footShown();
await until(() => foot()?.querySelector('[role="alert"]'), 'its third page failed');
await settle();
footShown();
await settle();
const button = foot().querySelector('button');
if (pages(2) !== 1 || !foot().textContent.includes('The feed is down.') || button.textContent.trim() !== 'Try again') problems.push(`a page failed, the long feed asked for it ${pages(2)} times and drew ${foot().textContent.trim()}`);
pagesFail = false;
button.click();
await until(() => drawn('Item 2.4') && !foot(), 'its third page, Try again pressed, and no foot after the last');
history.go(-1);
await until(() => levels() === 1, 'back from the long feed, Home');
} finally {
globalThis.IntersectionObserver = Observer;
}
say('a long feed paged as its foot came into view, once a page, never under a screen or after a page failed until Try again');
}
// Another's story tapped: its pager has no page of one's own, which opens at a form (Your story's `compose`), a page only of the pager it opens itself.