click event should not be dispatched if mouseforcewillbegin is prevented.
@paulrouget is already working on this.
Since Jun 8, 2016.
- Dominant language
- Rust
- Stars
- 38k
- Forks
- 3.8k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 465
Description
It is not documented clearly on https://developer.apple.com/library/mac/documentation/AppleApplications/Conceptual/SafariJSProgTopics/RespondingtoForceTouchEventsfromJavaScript.html, but with force touch API you can prevent click events from dispatching if you decide to handle force touch by calling event.preventDefault() at mouseforcewillbegin, which is pretty important otherwise user needs to communicate intend that force touch is being handled instead of click with in the application on it's own, which can be little tricky due to the fact that event propagation and the fact that force maybe handled on one layer while click it the other.
Here is an example I've put together
https://output.jsbin.com/mosodu
I if you try it on safari / webkit you'll notice that circle never becomes purple, neither isClicked becomes true unless you release while isForceBegan: false / circle is yellow.
On servo though you'll notice different behavior:
isForceBeganis nevertrue, presumably becauseservomouseforcewillbeginis never dispatched, while it supposed to right beforemousedown.isClickedbecomestrueregardless of when you release.- There are also some rendering issues, although that's not really related to this issue.
I suspect servomouseforcewillbegin was never implemented, which makes it impossible to cancel click events regardless if we handle force touch events or not.
I would expect servomouseforcewillbegin to be dispatched, before mousedown event & calling event.preventDefault() to prevent click event from being dispatched unless mouseup is dispatched before servomouseforcedown is.
P.S. You're supposed to click / touch the circle to observe force applied etc...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.