experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(pagestream): single Esc closes page after card flipping

Track when page:navigate is used for pagestream card flipping. On Esc,
skip accumulated webview history and close the window immediately
instead of requiring one Esc per navigation entry.

+12 -1
+12 -1
app/page/page.js
··· 847 847 } 848 848 }, api.scopes.GLOBAL); 849 849 850 - // Navigate to a new URL (used by pagestream to flip between cards) 850 + // Navigate to a new URL (used by pagestream to flip between cards). 851 + // Tracks the original URL so Escape can skip accumulated history. 852 + let pagestreamOriginalUrl = null; 853 + 851 854 api.subscribe('page:navigate', (msg) => { 852 855 if (msg.windowId != null && msg.windowId !== myWindowId) return; 853 856 const url = msg.url; 854 857 if (url) { 855 858 DEBUG && console.log('[page] page:navigate:', url); 859 + if (!pagestreamOriginalUrl) pagestreamOriginalUrl = webview.getURL(); 856 860 webview.loadURL(url); 857 861 navbar.setUrl(url); 858 862 } ··· 887 891 // --- Escape handling --- 888 892 889 893 api.escape.onEscape(() => { 894 + // If pagestream was flipping through cards, skip all accumulated history 895 + // and let backend close the window (return to pagestream) 896 + if (pagestreamOriginalUrl) { 897 + pagestreamOriginalUrl = null; 898 + DEBUG && console.log('[page] ESC: pagestream browsing, closing window'); 899 + return { handled: false }; // let backend close 900 + } 890 901 if (webview.canGoBack()) { 891 902 DEBUG && console.log('[page] ESC: webview going back'); 892 903 webview.goBack();