Closed Bug 1609199 Opened 4 years ago Closed 4 years ago

RDM Touch simulator + Dev Tools element picker on link causes link to be followed when selected

Categories

(DevTools :: Responsive Design Mode, defect, P3)

74 Branch
defect

Tracking

(firefox74 fixed)

RESOLVED FIXED
Firefox 74
Tracking Status
firefox74 --- fixed

People

(Reporter: valcus, Assigned: jdescottes)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0

Steps to reproduce:

When using the RDM built-in viewports for touch-based devices (e.g. iOS), touch simulation is turned on by default. When also using the Dev Tools element picker to select a link on the page, instead of just showing the <a> in the DOM and showing the styles, the link is instead followed.

Actual results:

Links that should be inspected only are loaded.

Expected results:

The link should only be selected, and not followed, when using the element picker.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Responsive Design Mode
Product: Firefox → DevTools

When I reproduce the bug, clicking the link does both things. I tried a mailto: link. The Inspector does show the selected anchor element, and the link is followed. I'll check to see if this is a regression.

Priority: -- → P3

This was regressed by the patch for Bug 1581799. I'm needinfo'ing the author of that patch, and also Julian in case this is an easy cleanup.

Flags: needinfo?(jdescottes)
Flags: needinfo?(chittorashobhit)
Regressed by: 1581799
Has Regression Range: --- → yes
Keywords: regression
Status: UNCONFIRMED → NEW
Ever confirmed: true

Thanks for the ping Brad! This issue seems non-trivial to fix.
The change that caused the issue is the following one:

--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js 
   _onPickerStarting: async function() {
     this.tellRDMAboutPickerState(true);
     this.pickerButton.isChecked = true;
     await this.selectTool("inspector", "inspect_dom");
+    // turn off color picker when node picker is starting
+    this.getPanel("inspector").hideEyeDropper();
     this.on("select", this.nodePicker.stop);
   },

Inspector::hideEyeDropper calls Inspector::stopEyeDropperListeners, which is:

  stopEyeDropperListeners: function() {
    this.toolbox.tellRDMAboutPickerState(false);
    this.inspectorFront.off("color-pick-canceled", this.onEyeDropperDone);
    this.inspectorFront.off("color-picked", this.onEyeDropperDone);
    this.walker.off("new-root", this.onEyeDropperDone);
  },

So going back to _onPickerStarting, we first call tellRDMAboutPickerState(true);, and then right after we call tellRDMAboutPickerState(false) (via stopEyeDropperListeners).
tellRDMAboutPickerState is used to disable touch simulation when a picker is used (color picker or element picker). And since we use a single flag for both, we get the bug described above. We need to be able to say "color picker is not used BUT element picker is used".

So the main issue is that we are using a single flag. We should change the implementation to let the TouchSimulator know if elementPicker is on and if colorPicker is on, independantly (in devtools/server/actors/emulation/touch-simulator.js). Another issue is that tellRDMAboutPickerState is async, but we never await on it anywhere. If we did, we could have worked around the issue by moving the call to this.getPanel("inspector").hideEyeDropper(); before the call to this.tellRDMAboutPickerState(true); in _onPickerStarting.

To make it easier for backward compat maybe we could simply add an optional type argument to setElementPickerState.

Flags: needinfo?(jdescottes)

We still need the front and the spec files to talk to older servers.
However we don't maintain forward compatibility, which means the server is not supposed to work with older clients.
So the emulation actor can be removed.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/219e155d358e
Remove Emulation Actor r=mtigley
https://hg.mozilla.org/integration/autoland/rev/40e2997a5397
Track picker types independantly in devtools touch-simulator.js r=mtigley
https://hg.mozilla.org/integration/autoland/rev/d7e6814835fe
Add RDM test browser_picker_link.js r=mtigley
Blocks: 1610576
Flags: needinfo?(chittorashobhit)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: