From c66909375a30f4e629d81cc734a48dd0896ba43f Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Fri, 13 Dec 2024 09:36:00 -0800 Subject: [PATCH] Make closeWatcher.requestClose() not require user activation Per the conversation here: https://github.com/openui/open-ui/issues/1128#issuecomment-2539519339 There's a desire to ship closeWatcher.requestClose() along with dialog.requestclose() both not requiring user activation. The spec PR has been updated accordingly: https://github.com/whatwg/html/pull/10737 (in this commit: https://github.com/whatwg/html/pull/10737/commits/76619aa99f37cef85be93ff98fadd03284347008) Fixed: 383593252 Change-Id: I8c05e352d8b4964407a1cee36f35372e192e2ca5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6092173 Auto-Submit: Mason Freed Reviewed-by: David Baron Reviewed-by: Mason Freed Commit-Queue: Mason Freed Cr-Commit-Position: refs/heads/main@{#1396007} --- close-watcher/basic.html | 6 +++--- close-watcher/inside-event-listeners.html | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/close-watcher/basic.html b/close-watcher/basic.html index 79a91e127ef684..1b092630559641 100644 --- a/close-watcher/basic.html +++ b/close-watcher/basic.html @@ -14,7 +14,7 @@ watcher.requestClose(); - assert_array_equals(events, ["cancel[cancelable=false]", "close"]); + assert_array_equals(events, ["cancel[cancelable=true]", "close"]); }, "requestClose() with no user activation"); test(t => { @@ -43,10 +43,10 @@ let watcher = createRecordingCloseWatcher(t, events); watcher.requestClose(); - assert_array_equals(events, ["cancel[cancelable=false]", "close"]); + assert_array_equals(events, ["cancel[cancelable=true]", "close"]); watcher.destroy(); - assert_array_equals(events, ["cancel[cancelable=false]", "close"]); + assert_array_equals(events, ["cancel[cancelable=true]", "close"]); }, "requestClose() then destroy()"); test(t => { diff --git a/close-watcher/inside-event-listeners.html b/close-watcher/inside-event-listeners.html index 47f431e2503674..93996fb5fee328 100644 --- a/close-watcher/inside-event-listeners.html +++ b/close-watcher/inside-event-listeners.html @@ -30,10 +30,10 @@ watcher.onclose = () => { watcher.destroy(); } watcher.requestClose(); - assert_array_equals(events, ["cancel[cancelable=false]", "close"]); + assert_array_equals(events, ["cancel[cancelable=true]", "close"]); watcher.requestClose(); - assert_array_equals(events, ["cancel[cancelable=false]", "close"], "since it was inactive, no more events fired"); + assert_array_equals(events, ["cancel[cancelable=true]", "close"], "since it was inactive, no more events fired"); }, "destroy() inside onclose"); promise_test(async t => { @@ -58,10 +58,10 @@ watcher.onclose = () => { watcher.close(); } watcher.requestClose(); - assert_array_equals(events, ["cancel[cancelable=false]", "close"]); + assert_array_equals(events, ["cancel[cancelable=true]", "close"]); watcher.requestClose(); - assert_array_equals(events, ["cancel[cancelable=false]", "close"], "since it was inactive, no more events fired"); + assert_array_equals(events, ["cancel[cancelable=true]", "close"], "since it was inactive, no more events fired"); }, "close() inside onclose"); promise_test(async t => { @@ -86,9 +86,9 @@ watcher.onclose = () => { watcher.requestClose(); } watcher.requestClose(); - assert_array_equals(events, ["cancel[cancelable=false]", "close"]); + assert_array_equals(events, ["cancel[cancelable=true]", "close"]); watcher.requestClose(); - assert_array_equals(events, ["cancel[cancelable=false]", "close"], "since it was inactive, no more events fired"); + assert_array_equals(events, ["cancel[cancelable=true]", "close"], "since it was inactive, no more events fired"); }, "requestClose() inside onclose");