touch-action is not working when event is registered

RESOLVED FIXED in Firefox 67

Status

()

defect
P3
normal
RESOLVED FIXED
9 months ago
5 months ago

People

(Reporter: jongmoon.yoon, Assigned: kats)

Tracking

(Blocks 1 bug)

63 Branch
mozilla67
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox67 fixed)

Details

Attachments

(3 attachments)

Posted file test.html
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36

Steps to reproduce:

Although the touch-action: none is specified on element, scroll is working in some situation.

More exact information reference the attached example html file.

1. following HTML structure

```html
<div class="pics">
  <div class="content"></div> // ...
</div>
<div class="overlay" style="touch-action:none">
  <div class="box"></div>
</div>
```
2. register touchEvent on ".overlay"
```js
document.querySelector(".overlay").addEventListener("touchstart", () => {});
```

3. open page & drag box(".box")


Actual results:

scroll is activated although touch-action is none.


Expected results:

scroll should be deactivated.
This issue is triggered by following "hammer.js" issue.

https://github.com/naver/hammer.js/issues/8
Botond this looks similar to bug 1501382. Is it a dupe?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(botond)
No, I think it's different issue although it may share same reason internally.

My point is "touch-action:none" is not working only if event handler is registered on that element.
(In reply to Kevin Brosnan [:kbrosnan] from comment #3)
> Botond this looks similar to bug 1501382. Is it a dupe?

Bug 1501382 talks about opacity:0 divs, and there is no use of opacity in this testcase, so I'd say not a dupe.
Flags: needinfo?(botond)
Component: General → Panning and Zooming
Product: Firefox for Android → Core
Version: Firefox 63 → 63 Branch
I think this is likely because the overlay and box divs are both fixed-position. So when we walk up from the box using the frame tree in the main thread fallback (triggered by the event listeners) at [1] it doesn't walk through the overlay and so doesn't see the touch-action property.

A workaround is to also set touch-action:none on the box div. Or if you can make the event listeners passive that should work too.

[1] https://searchfox.org/mozilla-central/rev/3160ddc1f0ab55d230c595366662c62950e5c785/gfx/layers/apz/util/TouchActionHelper.cpp#89
Priority: -- → P3
Assignee: nobody → kats

When walking up the frame parent chain to compute the touch-action on an
element, we should use the in-flow parent. This produces different
values for out-of-flow frames (e.g. fixed-position frames). This is more
in line with the actual spec for touch-action, which propagates down the
DOM.

Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/db7eb307e78b
Walk up to the in-flow parent when computing touch-action. r=botond
https://hg.mozilla.org/integration/autoland/rev/e925aaf5ac9a
Add a mochitest. r=botond
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.