{"id":246929,"date":"2016-10-22T16:26:16","date_gmt":"2016-10-22T23:26:16","guid":{"rendered":"http:\/\/css-tricks.com\/?p=246929"},"modified":"2016-10-22T16:26:16","modified_gmt":"2016-10-22T23:26:16","slug":"cant-detect-touchscreen","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/cant-detect-touchscreen\/","title":{"rendered":"You Can’t Detect A Touchscreen"},"content":{"rendered":"
Stu Cox explains that there are a ton of ways you might think you can get a yes-or-no answer on whether a browser supports touch or not:<\/p>\n
The normal refrain around this is “there are devices that are both<\/strong>, so you’d be wrong on those,”<\/em> which is true, but it’s actually more problematic than that. These testing methods are often just straight up wrong<\/em>. <\/p>\n So:<\/p>\n For layouts, assume everyone has a touchscreen. Mouse users can use large UI controls much more easily than touch users can use small ones. The same goes for hover states.<\/p>\n For events and interactions, assume anyone may have a touchscreen. Implement keyboard, mouse and touch interactions alongside each other, ensuring none block each other.<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":" Stu Cox explains that there are a ton of ways you might think you can get a yes-or-no answer on whether a browser supports touch or not: Width media queries Touch-related DOM events Touch-related APIs Pointer media queries The normal refrain around this is “there are devices that are both, so you’d be wrong on […]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[17],"tags":[887,888,886,889],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/246929"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=246929"}],"version-history":[{"count":1,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/246929\/revisions"}],"predecessor-version":[{"id":246930,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/246929\/revisions\/246930"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=246929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/categories?post=246929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=246929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n