Closed Bug 1506497 Opened 6 years ago Closed 6 years ago

touch-action is not working when event is registered

Categories

(Core :: Panning and Zooming, defect, P3)

63 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: jongmoon.yoon, Assigned: kats)

References

Details

Attachments

(3 files)

Attached file test.html (deleted) β€”
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.
https://bug1506497.bmoattachments.org/attachment.cgi?id=9024337
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
Per docs at https://searchfox.org/mozilla-central/rev/3160ddc1f0ab55d230c595366662c62950e5c785/layout/generic/nsIFrame.h#823 using GetInFlowParent instead of GetParent might fix this, but I didn't try it.
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.

Attached file Bug 1506497 - Add a mochitest. r?botond (deleted) β€”

Depends on D23570

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: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: