Forums

Posting in these forums is disabled. These forums will be available for archive purposes. Please join the new forums at the links below:

  • yui-support - replaces the `YUI 3.x` and `YUI 3 Gallery` forums.
    We have created the following discussion categories within this group to aid discoverability for these most-used topics:
    • Charts for YUI Charts support.
    • DataTable for YUI DataTable support.
    • Gallery for YUI Gallery support, including support for published Gallery components as well as the Gallery process in general.
    • Tools for support of YUI’s suite of developer tools such as selleck, shifter, grover, yogi, etc.
    • Everything Else for questions that don’t fit one of the categories above, we’ve got you covered here.
  • yui-deprecated - replaces the `YUI 2.x` forum and the forums of other deprecated products (`YUI Doc`, `Builder`, `YUI PHP Loader`, etc.).
  [ 8 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic

Rick Byers

  • Username: rbyers
  • Joined: Mon Dec 17, 2012 12:49 pm
  • Posts: 3
  • Offline
  • Profile
Tags:
  • button
  • chrome
  • docs
  • event

Are touch and mouse input assumed to be mutually exclusive?

Post Posted: Mon Dec 17, 2012 1:03 pm
+0-
Hi,
I lead a team working on touchscreen support in the Chrome browser. We're looking at sites that behave poorly on devices that have both a touchscreen and a mouse (eg. the new batch of Windows 8 devices), and we've found that some of the websites that have problems are built using YUI. I don't know much about YUI and have never programmed with it myself, so please pardon my ignorance here.

From the example here: http://yuilibrary.com/yui/docs/event/swipe-example.html, it seems that YUI will register for mouse events ONLY when touch events aren't supported. With Chrome, we may support both touch and mouse events. We noticed this by people complaining that sites like http://www.zillow.com/ are unusable on laptops that happen to have a touchscreen.

Is it by-design that YUI disables mouse support when it sees touch support? If there are issues that make it difficult to support both touchevents afnd mouseevents then we'd love to work with you on improving the web platform here (actually I'd love to hear about any issues you have with touchevents generally). It looks like things work a little better in IE10 (which uses pointer events), but there are problems there as well (eg. in the sample, swiping often causes the page to scroll rather than show the delete button).

Thanks,
Rick

Tilo Mitra

YUI Developer

  • Username: tilomitra
  • Joined: Tue Mar 16, 2010 7:30 am
  • Posts: 13
  • Location: Sunnyvale
  • Twitter: tilomitra
  • GitHub: tilomitra
  • Gists: tilomitra
  • IRC: tilomitra
  • YUI Developer
  • Offline
  • Profile
Tags:
  • css
  • docs
  • element
  • event

Re: Are touch and mouse input assumed to be mutually exclusi

Post Posted: Mon Dec 17, 2012 4:40 pm
+0-
Hey Rick,

I can speak for the event-touch stuff specifically. You're right. Under the hood, YUI does feature detection to determine if touch events are supported, or if MSPointer events are supported. If neither of these are, it reverts to standard mouse events.

You can still choose to hook multiple subscriber to an element to handle your use case (subscribe a "tap" event and a "click" event to the same element).

Regarding your issue re. MSPointer events scrolling the page sometimes, have you tried setting the -ms-touch-action CSS property on the element? We have some more information about this here: http://yuilibrary.com/yui/docs/event/gestures.html

Rick Byers

  • Username: rbyers
  • Joined: Mon Dec 17, 2012 12:49 pm
  • Posts: 3
  • Offline
  • Profile

Re: Are touch and mouse input assumed to be mutually exclusi

Post Posted: Wed Dec 19, 2012 6:15 pm
+0-
Thanks Tlio.
Using pointer events when they're supported instead of mouse events makes sense (since pointer events embody both touch and mouse input). But using touch events INSTEAD of mouse events is wrong for browsers that support both (Chrome, Opera, FireFox) - it breaks mouse usage. For scenarios like Windows laptops with touch screens, you're probably better off not supporting touch at all then supporting touch at the expense of mouse. Since this seems to affect all apps using YUI, it seems the right fix is in YUI itself, as opposed to the individual apps - right?

Regarding the page scrolling in IE, I agree that touch-action is probably missing. But this isn't my code I'm talking about, it's the sample page here: http://yuilibrary.com/yui/docs/event/swipe-example.html.

Rick

Aaron Spike

  • Username: acspike
  • Joined: Fri Jan 18, 2013 9:59 am
  • Posts: 1
  • GitHub: acspike
  • Gists: acspike
  • IRC: ACSpike
  • Offline
  • Profile
Tags:
  • ticket
  • yui3

Re: Are touch and mouse input assumed to be mutually exclusi

Post Posted: Fri Jan 18, 2013 10:38 am
+0-
Here's an example of this issue from the YUI bug tracker.

http://yuilibrary.com/projects/yui3/ticket/2533070

Tilo Mitra

YUI Developer

  • Username: tilomitra
  • Joined: Tue Mar 16, 2010 7:30 am
  • Posts: 13
  • Location: Sunnyvale
  • Twitter: tilomitra
  • GitHub: tilomitra
  • Gists: tilomitra
  • IRC: tilomitra
  • YUI Developer
  • Offline
  • Profile
Tags:
  • app
  • docs
  • event

Re: Are touch and mouse input assumed to be mutually exclusi

Post Posted: Wed Feb 13, 2013 11:03 am
+0-
Yikes. I didn't realize that code blocks were actually pre blocks. Here's an easier-to-read version:

-----

By nature, YUI does not disable mouse interactions when touch is present (not that I know of, at least). For instance, in the swipe-to-delete example (http://yuilibrary.com/yui/docs/event/sw ... ntent.html), the event-listeners only subscribe to `gesturemove*` events, which aren't present in a mouse-only environment. This is an implementation decision for this specific example, since it's showing how to use the `event-move` module.

Currently, we don't abstract `gesturemove*` and `touch*` so that they use `mouse*` events when touch isn't supported. We leave it to the app developer to set event listeners for both, touch and mouse, if they wish to support both forms of inputs.

The only exception to this that I know of is our `event-tap` module. When you subscribe to the "tap" event, the module will listen for touch events when present, and fall back to mouse events when they aren't present. The code that's responsible for doing this in YUI resides in the `Y.Event._GESTURE_MAP` object here: (https://github.com/yui/yui3/blob/master ... ch.js#L139).

I'm interested in how you think we should proceed. Is abstracting out these `touch*` and `gesture*` events so they fallback to mouse when touch isnt present the way to go? Or is it better to leave that decision to the app developer?

Rick Byers

  • Username: rbyers
  • Joined: Mon Dec 17, 2012 12:49 pm
  • Posts: 3
  • Offline
  • Profile
Tags:
  • app
  • docs
  • event
  • github
  • yui3

Re: Are touch and mouse input assumed to be mutually exclusi

Post Posted: Fri Feb 15, 2013 11:06 am
+0-
Quote:
By nature, YUI does not disable mouse interactions when touch is present (not that I know of, at least). For instance, in the swipe-to-delete example (http://yuilibrary.com/yui/docs/event/sw ... ntent.html), the event-listeners only subscribe to `gesturemove*` events, which aren't present in a mouse-only environment. This is an implementation decision for this specific example, since it's showing how to use the `event-move` module.


The gesture documentation appears to disagree with this, eg: "The event-move module normalizes gestures across mouse and touch environments." [http://yuilibrary.com/yui/docs/event/gestures.html]. In particular, that chart there listing three environments "touch", "mouse" and "MSPointer" is suggestive of the same problem (where is touch+mouse?). Also my experiments agree with the documentation - eg. the swipe example I CAN trigger it with a mouse but only on devices without a touchscreen.

Quote:
The only exception to this that I know of is our `event-tap` module. When you subscribe to the "tap" event, the module will listen for touch events when present, and fall back to mouse events when they aren't present. The code that's responsible for doing this in YUI resides in the `Y.Event._GESTURE_MAP` object here: (https://github.com/yui/yui3/blob/master ... ch.js#L139).


That case sounds like problem. It means that apps that listen for 'tap' will work with a mouse unless touch events happen to be supported, right?

Quote:
I'm interested in how you think we should proceed. Is abstracting out these `touch*` and `gesture*` events so they fallback to mouse when touch isnt present the way to go? Or is it better to leave that decision to the app developer?


In general, libraries and applications should consider mouse and touch as independent features - avoid any "fallback when touch isn't present" mechanisms. But in terms of what should be left to the app developer and what should be handled by the library, I don't have the experience to comment. If you're abstracting something on top of lower level input events (as in the case of 'gestures') then you should handle mouse+touch. Otherwise the application obviously needs to be aware of it.

Of course, the actual problems I've seen with sites using YUI in practice might be site bugs not YUI library bugs, I'm not sure (eg. you can't pan a map with the mouse on zillow.com when touch support is enabled). But I'm hoping we can get any library-level bugs fixed since that can impact multiple sites.

Thanks!
Rick

Tilo Mitra

YUI Developer

  • Username: tilomitra
  • Joined: Tue Mar 16, 2010 7:30 am
  • Posts: 13
  • Location: Sunnyvale
  • Twitter: tilomitra
  • GitHub: tilomitra
  • Gists: tilomitra
  • IRC: tilomitra
  • YUI Developer
  • Offline
  • Profile

Re: Are touch and mouse input assumed to be mutually exclusi

Post Posted: Thu Feb 21, 2013 5:21 pm
+0-
Thanks for the feedback Rick. I'm going to bounce this off a few people in the YUI Team, to see what the best way to proceed is. We normally have a weekly Developer Round-table on Thursdays at 2pm PST, and I'd like to bring up this topic for the next one.

It would be awesome if you could join in on that. I'll try to have some conducive steps by then too, on how we should code this.

amaansiddiqui

  • Username: aliza12
  • Joined: Mon Jun 03, 2013 9:48 pm
  • Posts: 1
  • GitHub: amaan
  • Gists: amaan
  • IRC: amaan
  • Offline
  • Profile

Re: Are touch and mouse input assumed to be mutually exclusi

Post Posted: Mon Jun 03, 2013 9:55 pm
+0-
Hi,Guys
Currently, we don't abstract `gesturemove*` and `touch*` so that they use `mouse*` events when touch isn't supported. We leave it to the app developer to set event listeners for both, touch and mouse, if they wish to support both forms of inputs.

The only exception to this that I know of is our `event-tap` module. When you subscribe to the "tap" event, the module will listen for touch events when present, and fall back to mouse events when they aren't present.,,,
  [ 8 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum