The Modernizr touchevents test will be removed in Drupal 10.
There is a replacement library that will continue to provide the .touchevents and .no-touchevents classes to the <body> element: core/drupal.touchevents-test. However, this replacement does not provide this information to JavaScript (i.e. there is no equivalent to Modernizr.touchevents within JavaScript).
Although core/drupal.touchevents-test continues to add .touchevents and .no-touchevents classes for backwards compatibility purposes, the long term goal is to phase this test out entirely, for the same reasons Modernizr is phasing theirs out. In addition to there not being a truly reliable way to detect touch devices, even properly detected ones may also use a pointer device. Drupal is aiming to refactor it's designs to not depend on this unreliable detection, and core/drupal.touchevents-test will be deprecated as soon as those changes are made.
Comments
I don't think that it is needed globally.
Very specific cases to use.
On JS side - we can just set the touchstart action or
const touch = matchMedia('(hover: none)').matches;For CSS just provide specific media for determining - hover and desktop.
All major browser's support
https://caniuse.com/css-media-interaction
www.ArtReaktor.com