Closed Bug 1891221 Opened 1 year ago Closed 1 year ago

Fix broken feature: click-hold context menus

Categories

(Core :: DOM: Events, defect)

defect

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: jackyzy823, Assigned: jackyzy823)

References

Details

Attachments

(2 files)

Currently , Feature "click-hold to open contextmenu" is broken on Desktop and Fenix.

  1. On Desktop/Fenix, Enable feature via about:config setting ui.click_hold_context_menus to true, click and hold on a link, nothing happens.

    Root cause:
    With the help of :botond and :masayuki , found that the target of "contextmenu" is not Element , is just text node.

    So in desktop , referrerinfo couldn't be extracted from text node. https://bugzilla.mozilla.org/show_bug.cgi?id=1805341#c18

    In fenix, the event will not be passed to GeckoView part due to https://searchfox.org/mozilla-central/source/mobile/android/actors/ContentDelegateChild.sys.mjs#83 https://bugzilla.mozilla.org/show_bug.cgi?id=1805341#c14

  2. If 1) is fixed, then new problem occurs on Fenix

    https://bugzilla.mozilla.org/show_bug.cgi?id=1805341#c18

    In Fenix, if i mousedown on the link and hold , the contextmenu will show, and then when i don't move mouse and then mouseup on the link , then navigating to the link will happens. If i move mouse out of the link then mouseup, this won't happen.

  1. If 1) is fixed , then new problem also occurs on Desktop.

    When click-holding on the link, then move mouse around, the link is shadow dragged with the mouse. See attachment for demostration.

    This is caused by https://searchfox.org/mozilla-central/rev/98a54cbdc5964e778af0e6b325f9e7831f00c05b/dom/events/EventStateManager.cpp#2137-2139

    I wanted to add "aEvent.preventDefault();" at https://searchfox.org/mozilla-central/rev/98a54cbdc5964e778af0e6b325f9e7831f00c05b/browser/actors/ContextMenuChild.sys.mjs#678 to resolve this issue, and found that it was previously added in https://hg.mozilla.org/mozilla-central/rev/ecba465c6a02d692374c6240182b097130873019#l1.121 for Bug 1505909 but removed due to bug 1558506

    So a better approach is required.

  2. If 1) is fixed , then new problem also occurs on Desktop.

    "Mouseup" event won't be triggered when releasing mouse button after click-holding triggering contextmenu.

    Only after doing anther mouse click ( press and release) , then "mouseup" event (and only this event) will be triggered.
    I guess that the mousedown event of pressing button is captured by the parent UI, so only mouseup event of releasing button is passed to content UI.

    This might not be a big issue, although the behavior is different with Fenix.

Attached image click-hold_but_drag.gif

The Bugbug bot thinks this bug should belong to the 'Fenix::General' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Product: Firefox → Fenix
Product: Fenix → Firefox

A bit more about 3)

If i want to force to stop tracking drag gesture by comment out these lines : https://searchfox.org/mozilla-central/rev/83ac77eef5a02e3c7d0d6bcc1e28a8f0700d4b5e/dom/events/EventStateManager.cpp#2137,2139 , click-holding the link in options page embedded in the about:addons details view to open contextmenu will still make the embeded page dragging with the mouse (or causing selecting other text in the about:addons page)

Furthermore , i guess 3) is related to 4)

If 4) is fixed, then 3) might behave correctly.

Assignee: nobody → jackyzy823
Status: NEW → ASSIGNED
Component: General → DOM: Events
Product: Firefox → Core
Severity: -- → S3
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/564ba45d2ceb Make contextmenu event of click-hold applying to Element. r=masayuki

Backed out for causing mochitest-plain failures on test_coalesce_mousewheel.html.

[task 2024-05-23T02:36:13.794Z] 02:36:13     INFO - TEST-START | dom/events/test/test_coalesce_mousewheel.html
[task 2024-05-23T02:36:19.959Z] 02:36:19     INFO - GECKO(1521) | JavaScript error: http://mochi.test:8888/tests/SimpleTest/EventUtils.js, line 202: Error: The element or the window did not become interactive
[task 2024-05-23T02:41:14.492Z] 02:41:14     INFO - TEST-INFO | started process screentopng
[task 2024-05-23T02:41:14.667Z] 02:41:14     INFO - TEST-INFO | screentopng: exit 0
[task 2024-05-23T02:41:14.667Z] 02:41:14     INFO - TEST-UNEXPECTED-FAIL | dom/events/test/test_coalesce_mousewheel.html | Test timed out. - 
[task 2024-05-23T02:41:15.598Z] 02:41:15     INFO - Not taking screenshot here: see the one that was previously logged
[task 2024-05-23T02:41:15.599Z] 02:41:15     INFO - TEST-UNEXPECTED-FAIL | dom/events/test/test_coalesce_mousewheel.html | [SimpleTest.finish()] No checks actually run. (You need to call ok(), is(), or similar functions at least once.  Make sure you use SimpleTest.waitForExplicitFinish() if you need it.) 
[task 2024-05-23T02:41:15.599Z] 02:41:15     INFO -     SimpleTest.ok@SimpleTest/SimpleTest.js:426:16
[task 2024-05-23T02:41:15.599Z] 02:41:15     INFO -     afterCleanup@SimpleTest/SimpleTest.js:1477:18
[task 2024-05-23T02:41:15.599Z] 02:41:15     INFO -     executeCleanupFunction@SimpleTest/SimpleTest.js:1562:7
[task 2024-05-23T02:41:15.599Z] 02:41:15     INFO -     SimpleTest.finish@SimpleTest/SimpleTest.js:1582:3
[task 2024-05-23T02:41:15.599Z] 02:41:15     INFO -     killTest@SimpleTest/TestRunner.js:200:22
[task 2024-05-23T02:41:15.599Z] 02:41:15     INFO -     async*delayedKillTest@SimpleTest/TestRunner.js:243:17
[task 2024-05-23T02:41:15.599Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:241:17
[task 2024-05-23T02:41:15.599Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.599Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     setTimeout handler*TestRunner._checkForHangs@SimpleTest/TestRunner.js:255:15
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     TestRunner.runTests/<@SimpleTest/TestRunner.js:535:16
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     Async*TestRunner.runTests@SimpleTest/TestRunner.js:522:48
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     RunSet.runtests@SimpleTest/setup.js:285:14
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     RunSet.runall@SimpleTest/setup.js:264:12
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     getPrefList/<@SimpleTest/setup.js:351:14
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     loadFile/req.onload@SimpleTest/setup.js:80:19
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     EventHandlerNonNull*loadFile@SimpleTest/setup.js:75:3
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     getPrefList@SimpleTest/setup.js:349:13
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     hookupTests@SimpleTest/setup.js:372:5
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO - parseTestManifest@http://mochi.test:8888/manifestLibrary.js:53:13
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO - getTestManifest/req.onload@http://mochi.test:8888/manifestLibrary.js:66:28
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO - EventHandlerNonNull*getTestManifest@http://mochi.test:8888/manifestLibrary.js:62:3
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO -     hookup@SimpleTest/setup.js:337:20
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO - EventHandlerNonNull*@http://mochi.test:8888/tests?autorun=1&closeWhenDone=1&consoleLevel=INFO&manifestFile=tests.json&dumpOutputDirectory=%2Ftmp&cleanupCrashes=true&ignorePrefsFile=ignorePrefs.json:10:32
[task 2024-05-23T02:41:15.600Z] 02:41:15     INFO - GECKO(1521) | MEMORY STAT | vsize 2604MB | residentFast 133MB | heapAllocated 13MB
[task 2024-05-23T02:41:15.646Z] 02:41:15    ERROR - TEST-UNEXPECTED-FAIL | /tests/dom/events/test/test_coalesce_mousewheel.html logged result after SimpleTest.finish(): [SimpleTest.finish()] No checks actually run. (You need to call ok(), is(), or similar functions at least once.  Make sure you use SimpleTest.waitForExplicitFinish() if you need it.)
[task 2024-05-23T02:41:15.661Z] 02:41:15     INFO - TEST-OK | dom/events/test/test_coalesce_mousewheel.html | took 301868ms
[task 2024-05-23T02:41:15.702Z] 02:41:15     INFO - TEST-START | dom/events/test/test_coalesce_touchmove.html
Flags: needinfo?(jackyzy823)
Flags: needinfo?(jackyzy823)
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/d0f10d9f39d5 Make contextmenu event of click-hold applying to Element. r=masayuki
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
Duplicate of this bug: 1805341
See Also: 1805341
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: