there must be a nicer way by detecting the input device?
As we move to devices that are multi-input (Win8 laptops or Chromebooks with both a touchscreen and traditional mouse/trackpad/keyboard, plus any upcoming input modalities like Kinect-style cameras etc), it’s increasingly difficult to make assumptions about what input a user will first of all HAVE on their device, and second which input they will USE.
“A priori” one should assume that a user has all sorts of inputs at their disposal. You can only say that yes, a user has a touchscreen, once you get the very first touch-specific event (either a touchstart, or a pointer event of type touch/stylus). After that, it’s still not to say that the user will continue using that input modality exclusively. But this problem is not new…there’s not been any way to determine if one is a keyboard-only or mouse user, so we’ve ideally had to code for both situations. So, the same way, we should make sure our sites/web apps work with all types of inputs. It’s not a technical challenge I’d say (particularly once we have Pointer Events supported in most browsers – already in IE, soon in Firefox and Chrome – which homogenise the event handling in an input-agnostic way, but also allow to determine the type of an input if we want to run specific code based on different modality), but mainly a problem/challenge of design/UX.
In response to Shane’s comment:
As we move to devices that are multi-input (Win8 laptops or Chromebooks with both a touchscreen and traditional mouse/trackpad/keyboard, plus any upcoming input modalities like Kinect-style cameras etc), it’s increasingly difficult to make assumptions about what input a user will first of all HAVE on their device, and second which input they will USE.
“A priori” one should assume that a user has all sorts of inputs at their disposal. You can only say that yes, a user has a touchscreen, once you get the very first touch-specific event (either a touchstart, or a pointer event of type touch/stylus). After that, it’s still not to say that the user will continue using that input modality exclusively. But this problem is not new…there’s not been any way to determine if one is a keyboard-only or mouse user, so we’ve ideally had to code for both situations. So, the same way, we should make sure our sites/web apps work with all types of inputs. It’s not a technical challenge I’d say (particularly once we have Pointer Events supported in most browsers – already in IE, soon in Firefox and Chrome – which homogenise the event handling in an input-agnostic way, but also allow to determine the type of an input if we want to run specific code based on different modality), but mainly a problem/challenge of design/UX.