Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: skip stationary wrappers when locating Outlook scrolling (#11021)

Adam Eivy62544c12a4bc
diff --git a/server/services/messagePlaywrightSync.js b/server/services/messagePlaywrightSync.js
index 4035448605..8e894ccc48 100644
--- a/server/services/messagePlaywrightSync.js
+++ b/server/services/messagePlaywrightSync.js
@@ -40,13 +40,19 @@ function outlookRowContext(selector, requireScroll = true) {
// ARIA regions can wrap a separate scrolling element. Walk from the rows
// outward instead of assuming the region or list parent can actually scroll.
let scrollContainer;
+ let stationaryContainer;
for (let parent = initialRows[0].parentElement; parent; parent = parent.parentElement) {
- if (/auto|scroll|overlay|hidden/.test(getComputedStyle(parent).overflowY)
- || (parent === document.scrollingElement && parent.scrollHeight > parent.clientHeight)) {
+ const overflow = getComputedStyle(parent).overflowY;
+ const scrollable = /auto|scroll|overlay|hidden/.test(overflow) || parent === document.scrollingElement;
+ if (scrollable && parent.scrollHeight > parent.clientHeight) {
scrollContainer = parent;
break;
}
+ // An inbox that fits entirely still has a usable scrolling surface. Prefer
+ // any ancestor with actual overflow before accepting that stationary case.
+ if (!stationaryContainer && /auto|scroll|overlay/.test(overflow)) stationaryContainer = parent;
}
+ scrollContainer ||= stationaryContainer;
if (!scrollContainer || typeof scrollContainer.scrollBy !== 'function'
|| typeof scrollContainer.scrollTo !== 'function'
|| initialRows.some(row => !scrollContainer.contains(row))) {
diff --git a/server/services/messagePlaywrightSync.test.js b/server/services/messagePlaywrightSync.test.js
index a2d0472007..95fd3c1886 100644
--- a/server/services/messagePlaywrightSync.test.js
+++ b/server/services/messagePlaywrightSync.test.js
@@ -152,9 +152,10 @@ describe('Outlook configured row extraction', () => {
};
const staticRegion = { contains: () => true, scrollBy() {}, scrollTo() {} };
if (container === 'nested') scroll.parentElement = staticRegion;
+ const wrapper = { parentElement: scroll, scrollHeight: 100, clientHeight: 100, scrollBy() {}, scrollTo() {}, contains: () => true };
const list = { parentElement: scroll };
const rows = paints.map(records => records.map(data => ({
- ...attr({ 'data-itemid': data.providerRowId }), parentElement: container === 'none' ? null : container === 'list' ? list : scroll,
+ ...attr({ 'data-itemid': data.providerRowId }), parentElement: container === 'none' ? null : container === 'wrapper' ? wrapper : container === 'list' ? list : scroll,
closest: sel => container === 'nested' && sel === '[role="region"]' ? staticRegion
: container === 'region' && sel === '[role="region"]' ? scroll
: container === 'list' && sel.includes('[role="listbox"]') ? list : null,
@@ -184,7 +185,7 @@ describe('Outlook configured row extraction', () => {
};
evaluateOnPage.mockImplementation((_page, script) => vm.runInNewContext(script, {
document, location: { href: 'https://example.com/mail/' },
- getComputedStyle: el => ({ overflowY: el === scroll ? 'auto' : 'visible' }), setTimeout: callback => callback()
+ getComputedStyle: el => ({ overflowY: el === scroll || el === wrapper ? 'auto' : 'visible' }), setTimeout: callback => callback()
}));
return { clicked, scroll };
}
@@ -213,7 +214,7 @@ describe('Outlook configured row extraction', () => {
expect(clicked).toEqual(['first', 'second', 'second']);
});
- it.each(['region', 'list', 'overflow', 'nested'])('retains bounded full/unread virtualized scrolling with a %s container', async container => {
+ it.each(['region', 'list', 'overflow', 'nested', 'wrapper'])('retains bounded full/unread virtualized scrolling with a %s container', async container => {
for (const selector of [defaultSelector, customSelector]) {
tryReadFile.mockResolvedValue(selector === defaultSelector ? '{}' : JSON.stringify({ outlook: { messageRow: selector } }));
for (const mode of ['unread', 'full']) {
@@ -233,6 +234,14 @@ describe('Outlook configured row extraction', () => {
}
});
+ it('extracts an inbox that fits entirely in its scrolling surface', async () => {
+ const { scroll } = mailbox([[record('only-row')]]);
+ scroll.scrollHeight = scroll.clientHeight;
+ expect(await syncPlaywright(account, { messages: [] })).toMatchObject({
+ status: 'success', inboxComplete: false, messages: [expect.objectContaining({ providerRowId: 'only-row', bodyFull: true })]
+ });
+ });
+
it('caps full/unread extraction even when more rows are visible', async () => {
for (const [mode, cap] of [['unread', 100], ['full', 200]]) {
const { scroll } = mailbox([Array.from({ length: 210 }, (_, i) => record(`row-${i}`))]);