Skip to content

Commit 7da6f5b

Browse files
committed
fix(web): let Windows attention alerts time out
Approval and input alerts can be resolved from another client while this window stays unfocused, so only completions stay on screen.
1 parent bafedad commit 7da6f5b

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

‎apps/web/src/components/ThreadNotificationCoordinator.browser.test.tsx‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ describe("thread notifications", () => {
380380
});
381381
});
382382

383-
it("keeps Windows system alerts on screen so a click still reaches the app", async () => {
383+
it("keeps Windows completion alerts on screen so a click still reaches the app", async () => {
384384
await using app = setup();
385385
state.mode = "notifications";
386386
state.focused = false;
@@ -393,6 +393,20 @@ describe("thread notifications", () => {
393393
);
394394
});
395395

396+
it("lets Windows attention alerts time out since another client may resolve them", async () => {
397+
await using app = setup();
398+
state.mode = "notifications";
399+
state.focused = false;
400+
state.platform = "Win32";
401+
await app.render();
402+
state.input = true;
403+
await app.render();
404+
expect(state.notification).toHaveBeenCalledWith(
405+
"Input needed",
406+
expect.objectContaining({ requireInteraction: false }),
407+
);
408+
});
409+
396410
it("reveals the desktop window and opens the thread when a system alert is clicked", async () => {
397411
await using app = setup();
398412
const revealWindow = vi.fn(() => Promise.resolve());

‎apps/web/src/components/ThreadNotificationCoordinator.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,10 @@ function EnvironmentNotifications({
222222
body: thread.title,
223223
tag: threadNotificationTag(environmentId, thread.id),
224224
silent: true,
225-
// Windows drops clicks once a toast times out into Notification Center, so keep it
226-
// on screen until it is clicked or the window regains focus and clears it.
227-
requireInteraction: isWindowsPlatform(navigator.platform),
225+
// Windows drops clicks once a toast times out into Notification Center, so keep
226+
// completions on screen until clicked or cleared on focus. Attention alerts still time
227+
// out because another client can resolve them while this window stays unfocused.
228+
requireInteraction: kind === "completion" && isWindowsPlatform(navigator.platform),
228229
});
229230
onNotification(environmentId, notification);
230231
notification.addEventListener("click", () => {

0 commit comments

Comments
 (0)