Closed Bug 1608708 Opened 4 years ago Closed 4 years ago

dev tools: touchstart not cancelled by preventDefault, click still fired

Categories

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

72 Branch
defect

Tracking

(firefox-esr68 wontfix, firefox72 wontfix, firefox73 wontfix, firefox74 wontfix, firefox76 wontfix, firefox77 wontfix, firefox78 fixed)

RESOLVED FIXED
Tracking Status
firefox-esr68 --- wontfix
firefox72 --- wontfix
firefox73 --- wontfix
firefox74 --- wontfix
firefox76 --- wontfix
firefox77 --- wontfix
firefox78 --- fixed

People

(Reporter: radu.cx+github, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0

Steps to reproduce:

HTML:

<div id="mydiv">click me</div>
<div id="textout"></div>

JS:

var div = document.querySelector('#mydiv');
var f = function(e) {
    e.preventDefault();
    document.querySelector('#textout').innerText += e.type + "\n";
};
div.addEventListener('touchstart', f);
div.addEventListener('click', f);

On desktop (I used Linux), open the dev tools and enable Responsive Design Mode (Control+Shift+M)

Click on the first div.

Actual results:

Even though I do preventDefault, I still get both touchstart and click events on the desktop.

Additionally, if I also happen to listen for pointerdown I'm getting it twice. On mobile I only get pointerdown -> touchstart -> click if I don't preventDefault, but on desktop with dev simulated touches enabled I get pointerdown -> touchstart -> pointerdown -> click.

Expected results:

I should only get touchstart, not followed by click, when I preventDefault with simulated touches in Responsive Design Mode.

Hi Uplink,

Thanks for reporting this bug.

I was able to reproduce it on Windows 10 and Ubuntu 18.04 on the following Firefox builds:

  • Nightly: 74.0a1 (2020-01-17) (64-bit)
  • Beta: 73.0b6 (64-bit)
  • Release: 71.0 (64-bit) and 72.0.1 (64-bit)
  • ESR 68.4.2

I'm adding this issue to the Dev Tools: RDM area and hopefully, someone from their team will look over it.

Regards,
Virginia

Status: UNCONFIRMED → NEW
Component: Untriaged → Responsive Design Mode
Ever confirmed: true
Product: Firefox → DevTools

Thank you for filing this issue! Being able to correctly simulate touch events in RDM is an upcoming priority for the tool, so we appreciate all the feedback we can get. The observations made in the bug are likely related/similar to Bug 1501939 and Bug 1538709.

Priority: -- → P3
See Also: → 1501939, 1538709

Hi, Uplink! So the issue where "click" is still fired even when the handler calls preventDefault has been resolved via Bug 1623941, which is now available in Firefox Nightly (78.0a1). The second part where pointerdown is fired twice still remains an issue, which is planned to be fixed in Bug 1625827.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
See Also: 15019391625827
You need to log in before you can comment on or make changes to this bug.