tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 61ca779ecea00576d000e1d08960600fcddff3cd
parent 4dea06aa2fedd46ab199ec6cafa86d68e195b4a0
Author: Mason Freed <masonf@chromium.org>
Date:   Fri,  7 Nov 2025 08:57:16 +0000

Bug 1998571 [wpt PR 55883] - Reland "Implement mousedown-drag-mouseup menu behavior [3/4]", a=testonly

Automatic update from web-platform-tests
Reland "Implement mousedown-drag-mouseup menu behavior [3/4]"

This relands commit 166bc1f510d5d679ceb0ec7a01c3bfd59d1ba9db.

It was reverted because it was downstream of another change that
needed to be reverted. There were no issues directly from this
CL, so this is a clean reland of the same patch.

Original change's description:
> Implement mousedown-drag-mouseup menu behavior [3/4]
>
> This implements the same behavior we have in customizable-<select>, for
> the menu elements. Clicking the mouse on a menuitem that triggers a
> sub-menu, then dragging into the sub-menu, then releasing the mouse on
> an item in that sub-menu now selects that item.
>
> Bug: 406566432,453209085
> Change-Id: I0e5aef5412a100dff4d9e6638371fda3742b6162
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7068555
> Commit-Queue: Mason Freed <masonf@chromium.org>
> Reviewed-by: Dominic Farolino <dom@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1538873}

Change-Id: I32af066882cbedc056cec1dbca8b045806a8d9fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7113406
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Commit-Queue: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1540720}

--

wpt-commits: 8c6a6e7b4c958100f2e8616fec7d5afd6a314164
wpt-pr: 55883

Diffstat:
Mtesting/web-platform/tests/html/semantics/menu/tentative/menubar-invoke-menulist.html | 15++++++---------
Mtesting/web-platform/tests/html/semantics/menu/tentative/menuitem-activate.html | 50+++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 55 insertions(+), 10 deletions(-)

diff --git a/testing/web-platform/tests/html/semantics/menu/tentative/menubar-invoke-menulist.html b/testing/web-platform/tests/html/semantics/menu/tentative/menubar-invoke-menulist.html @@ -143,18 +143,15 @@ test(() => { assert_false(menulist.matches(":popover-open"), "menulist no longer matches :popover-open"); - // Being an invoker for a sub-menu causes checkability to stop. + // Being checkable causes sub-menu functionality to stop. checkableMenuitem.command = "toggle-menu"; checkableMenuitem.commandForElement = menulist; checkableMenuitem.click(); - assert_false(checkableMenuitem.checked, - "checkable menu item that invokes a menu does not become checked"); - assert_true(menulist.matches(":popover-open"), - "menulist matches :popover-open"); + assert_true(checkableMenuitem.checked, + "checkable menu item that invokes a menu becomes checked"); + assert_false(menulist.matches(":popover-open"), "menulist is not open"); checkableMenuitem.click(); - assert_false(checkableMenuitem.checked, - "checkable menu item is still not checked"); - assert_false(menulist.matches(":popover-open"), - "menulist no longer matches :popover-open"); + assert_false(checkableMenuitem.checked, "checkable menu item unchecks"); + assert_false(menulist.matches(":popover-open"), "menulist still not open"); }, "Checkable menuitems can still invoke menulist popovers"); </script> diff --git a/testing/web-platform/tests/html/semantics/menu/tentative/menuitem-activate.html b/testing/web-platform/tests/html/semantics/menu/tentative/menuitem-activate.html @@ -3,7 +3,9 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> <script src="/resources/testdriver-vendor.js"></script> +<script src="../../popovers/resources/popover-utils.js"></script> <link rel=author href=mailto:dom@chromium.org> <link rel=help href=https://open-ui.org/components/menu.explainer> @@ -14,6 +16,7 @@ <menulist id=mainmenu> <menuitem id=mainmenuitem command=toggle-menu commandfor=submenu>Toggle menu</menuitem> <menuitem id=mainmenuitem2 command=toggle-popover commandfor=popover>Show popover</menuitem> + <menuitem id=normalmenuitem>Normal item</menuitem> </menulist> <menulist id=submenu> @@ -101,7 +104,7 @@ promise_test(async (t) => { // Close the second, "sub", menu within the popover by just clicking off of // it. - await test_driver.click(menuinpopoveritem1); + await test_driver.click(menuinpopoveritem2); assert_false(menuinpopover2.matches(":popover-open"), "menu 2 in popover closes"); assert_true(popoverwithmenu.matches(":popover-open"), @@ -110,4 +113,49 @@ promise_test(async (t) => { "menu in popover remains open"); }, 'Menulist inside a popover works correctly; does not get accidentally ' + 'dismissed by opening submenus'); + +promise_test(async (t) => { + assert_false(mainmenu.matches(":popover-open"), "mainmenu popover starts closed"); + let clickCount = 0; + normalmenuitem.addEventListener('click',() => (++clickCount)); + const actions = new test_driver.Actions(); + await actions.addPointer('mouse', 'mouse') + .pointerMove(0, 0, {origin: menubarmenuitem}) + .pointerDown() + .send(); + await waitForRender(); + assert_true(mainmenu.matches(":popover-open"), "mainmenu popover should be open while mouse is down"); + assert_equals(clickCount,0, "no clicks yet"); + await actions.pointerMove(0, 0, {origin: normalmenuitem}) + .pointerUp() + .send(); + await waitForRender(); + assert_false(mainmenu.matches(":popover-open"), "mainmenu popover should be closed"); + // TODO: Menu items should fire an event when they are selected. + // The `click` event is not enough, because one won't be fired here. + // assert_equals(clickCount,1, "the sub-menu item should have been clicked"); +}, 'A mousedown-drag-mouseup gesture on a normal menuitem picks the item'); + +promise_test(async (t) => { + assert_false(mainmenu.matches(":popover-open"), "mainmenu popover starts closed"); + assert_false(submenu.matches(":popover-open"), "submenu popover starts closed"); + const actions = new test_driver.Actions(); + await actions.addPointer('mouse', 'mouse') + .pointerMove(0, 0, {origin: menubarmenuitem}) + .pointerDown() + .send(); + await waitForRender(); + assert_true(mainmenu.matches(":popover-open"), "mainmenu popover should be open while mouse is down"); + assert_false(submenu.matches(":popover-open"), "submenu shouldn't be open yet"); + await actions.pointerMove(0, 0, {origin: mainmenuitem}) + .pointerUp() + .send(); + await waitForRender(); + assert_true(mainmenu.matches(":popover-open"), "mainmenu popover should remain open, because submenu chosen"); + assert_true(submenu.matches(":popover-open"), "submenu popover should be open"); + menubarmenuitem.click(); // Cleanup. + await waitForRender(); + assert_false(mainmenu.matches(":popover-open"), "mainmenu popover should be closed"); + assert_false(submenu.matches(":popover-open"), "submenu popover should be closed"); +}, 'A mousedown-drag-mouseup gesture on a submenu item leaves both menus open'); </script>