fix: approval windows open as wide as the page (closes #518)
The approval window was opened 360 pixels wide while the page is 396, so it scrolled sideways and cut off the Reject button. It now opens at 396. Both browsers count the window's frame in that width, so the approval page also widens its own window by however far it would scroll sideways; the toolbar popup's window is left alone. The Firefox suite checks that the sign prompt does not scroll sideways. The Chrome suite cannot: its approval windows open at 1280x720 whatever size is asked. README's Visual Style line, which still said 360x600, now gives the page's real width. Model: opus-5-5
This commit is contained in:
@@ -21,6 +21,7 @@ const {
|
||||
goBack,
|
||||
} = require("./views/helpers");
|
||||
const { applyTheme } = require("./theme");
|
||||
const { windowsGetCurrent, windowsUpdate } = require("../shared/browserApi");
|
||||
// Renders a view the popup lands on without having navigated to it forward:
|
||||
// on restore here, and on Back. Only the views that can be fully re-rendered
|
||||
// from persisted state (RESTORABLE_VIEWS, src/shared/restorableViews.js) go
|
||||
@@ -233,6 +234,22 @@ async function init() {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const approvalId = params.get("approval");
|
||||
if (approvalId) {
|
||||
// The background opens this window as wide as the page, but the
|
||||
// browser counts the window's frame in that width, and how wide the
|
||||
// frame is depends on the browser and the system. The window is
|
||||
// widened by however far the page would scroll sideways. The
|
||||
// connection prompt can also show in the toolbar popup, whose window
|
||||
// is the user's browser window; that one is left alone.
|
||||
const sideways =
|
||||
document.documentElement.scrollWidth -
|
||||
document.documentElement.clientWidth;
|
||||
if (sideways > 0) {
|
||||
windowsGetCurrent().then((win) => {
|
||||
if (win.type === "popup") {
|
||||
windowsUpdate(win.id, { width: win.width + sideways });
|
||||
}
|
||||
});
|
||||
}
|
||||
// Deliberately not awaited, and deliberately not .catch()ed. show()
|
||||
// is async, so a throw past its first await surfaces as an unhandled
|
||||
// rejection rather than an uncaught error — measured as still failing
|
||||
|
||||
Reference in New Issue
Block a user