This behavior is not a bug, it's intended as a feature:
Simulate touch events on desktop
If you still want to disable it, follow those steps:
- Open the profile folder of Firefox:
- Go to
about:support
- Find the "Application Basics" section
- Find the "Profile Folder" entry in the table
- Click the "Show Folder" button
- Go to
- Go to the
extensions
subfolder - Find the folder of your simulator, e.g.
fxos_2_2_simulator@mozilla.org
- Go to
b2g/modules/devtools
subfolders - Open the
touch-events.js
file with a proper text editor Find the
sendContextMenu
function:sendContextMenu: function teh_sendContextMenu(target, x, y, delay) { let doc = target.ownerDocument; let evt = doc.createEvent('MouseEvent'); evt.initMouseEvent('contextmenu', true, true, doc.defaultView, 0, x, y, x, y, false, false, false, false, 0, null); let content = this.getContent(target); let timeout = content.setTimeout((function contextMenu() { target.dispatchEvent(evt); this.cancelClick = true; }).bind(this), delay); return timeout; },
Comment this line to avoid dispatching the event:
// target.dispatchEvent(evt);
Restart the Simulator
Note it's important to only prevent the dispatch of the event instead of not calling sendContextMenu
. Otherwise, the click wouldn't be cancelled (this.cancelClick = true
), so text selection wouldn't work properly.