10

I found Detecting touch devices and detecting 'can hover' with JavaScript in 2020 which is basically the same as What's the best way to detect a 'touch screen' device using JavaScript?. The asker acknowledges the previous posts, but claims the new question is needed:

This post here suggest a bazillion different ways to solve this. But it's now 2020 - and a lot has happend across browsers and devices, so I figured I would draw a line in the sand and start a new question.

Many of the answers doesn't consider all corner cases:

  • Like stylus'es
  • Like Apple's magic mouse that (apparently) emulated touch events (I heard of this, I haven't experienced it myself).
  • Like the new iPad Pro, which emulates a Macbook Pro's Safari.
  • Like if the capability changes, so the user gains/loses the ability to 'touch' (Like when enabling mobile-view with Chrome Developer tools).

Should this post be flagged/closed as duplicate, or is it justified? Given that answer on the older post are being updated, I personally would flag this specific post.

7
  • 9
    IMO questions of the form "How to XYZ in <Year>" add little value, it's not clear how the year differentiates the question from the previously asked one. If they mentioned specific EcmaScript / browser versions it might still make some sense otherwise just adding a "in 2020" is just more noise for the community. Commented Jul 23 at 10:25
  • 2
    A given answer may be valid at the time, but in the years since advice can move on, but if no one's going over old questions/answers to review the advice there then that stale advice can go unchecked, even if these days it's considered bad practice. Perhaps SO needs a way to deal with that scenario... Perhaps allowing users finding an existing answer to click something to trigger the "still relevant?" workflow, where people see the question and existing answers and can give date based upvotes to say "this was voted still relevant as of 2024", or else they can add new answers as needed...
    – JohnLBevan
    Commented Jul 23 at 11:02
  • 1
    (That said, others have proposed such a process before, but it doesn't seem to have gone down well: meta.stackoverflow.com/questions/315481/… / meta.stackoverflow.com/questions/306482/…) :/
    – JohnLBevan
    Commented Jul 23 at 11:05
  • 14
    "Perhaps SO needs a way to deal with that scenario" Ahh, like the ability to add (product) version tags to answers... Unfortunately SO are more keen to waste their time on developing features that the community hates.
    – Thom A
    Commented Jul 23 at 11:33
  • 1
    "so I figured I would draw a line in the sand and start a new question" - ah yes. A combination of "I will use Stack Overflow as I please" and "it's old and thus worthless" reasoning. The chance of that resulting in a Stack Overflow-compatible question is tiny.
    – Gimby
    Commented Jul 23 at 15:08
  • 2
    I didn't even notice that the user, in question, posted a self answered question as well. They should have just posted a new answer to the existing question; having new answers for edge cases and/or new features is desirable. If they weren't planning to post an answer, then they should have used the bounty feature, to attract new answers based on technological changes.
    – Thom A
    Commented Jul 23 at 15:46
  • 1
    Time to merge the OP's answer on their post into the existing duplicate target post?
    – Drew Reese
    Commented Jul 23 at 22:19

1 Answer 1

17

I don't think that the explanations in the new question post justify its separation from the old post.

Many of the answers doesn't consider all corner cases

Do you know the solution which correctly handles these corner cases? - Add a new answer. That new answer could contain not only the solution, but also the list of those "corner cases" where it could win other answers.

Do you know which existing answers don't handle those "corner cases"? - Add comments to those answers, or edit them and describe limitations.

Are there many existing answers which share some flaw in handling those "corner cases"? - Add a new answer which describes an approach (or approaches) which does not work, and explain why. E.g. everything under "My findings" in the new question could be posted as separate answers to the old question.


The new question just attracts answers which copy existing answers from the old question. E.g. that answer to the new question contains the same approach as described in that answer to the old question.

It could be that the problem of detecting touch devices has no "simple" solution, and one should combine existing solutions for handle at the same time: old browsers, new browsers, rare browsers, specific environments, etc. In that case having all solutions under the same question is much more preferred than having a new question with only "new" answers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .