From aa373a8803ab4f74a148b296f71108a8c449896e Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Fri, 20 Jan 2023 12:27:53 +0000
Subject: [PATCH] Issue #3239980 by longwave, lauriii, kostyashupenko, xjm,
 catch, bnjmnm, nod_, bbrala: Deprecate Modernizr

---
 core/core.libraries.yml                                |  1 +
 core/lib/Drupal/Core/Render/theme.api.php              |  4 ++--
 core/misc/cspell/dictionary.txt                        |  1 -
 core/themes/claro/claro.libraries.yml                  | 10 ++++------
 core/themes/claro/templates/details.html.twig          |  5 -----
 .../navigation/details--vertical-tabs.html.twig        |  5 -----
 core/themes/olivero/templates/form/details.html.twig   |  5 -----
 7 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/core/core.libraries.yml b/core/core.libraries.yml
index 1a188ec2f1d7..f0fb2c4fe6cc 100644
--- a/core/core.libraries.yml
+++ b/core/core.libraries.yml
@@ -798,6 +798,7 @@ modernizr:
   version: "3.11.7"
   js:
     assets/vendor/modernizr/modernizr.min.js: { preprocess: 0, weight: -21, minified: true }
+  deprecated: The %library_id% asset library is deprecated in Drupal 10.1.0 and will be removed in Drupal 11.0.0. See https://www.drupal.org/node/3333253
 
 normalize:
   remote: https://github.com/necolas/normalize.css
diff --git a/core/lib/Drupal/Core/Render/theme.api.php b/core/lib/Drupal/Core/Render/theme.api.php
index 5c57841f4a7a..c98ab3e4ed7e 100644
--- a/core/lib/Drupal/Core/Render/theme.api.php
+++ b/core/lib/Drupal/Core/Render/theme.api.php
@@ -164,8 +164,8 @@
  *   $variables['#attached'] @endcode, e.g.:
  *   @code
  *   function THEME_preprocess_menu_local_action(array &$variables) {
- *     // We require Modernizr's touch test for button styling.
- *     $variables['#attached']['library'][] = 'core/modernizr';
+ *     // We require touch events detection for button styling.
+ *     $variables['#attached']['library'][] = 'core/drupal.touchevents-test';
  *   }
  *   @endcode
  *
diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt
index 1d502548c095..3a3ab28b9ca5 100644
--- a/core/misc/cspell/dictionary.txt
+++ b/core/misc/cspell/dictionary.txt
@@ -712,7 +712,6 @@ mocktails
 mocky
 moderatable
 modernizr
-modernizr's
 modulenarrow
 mojito
 montag
diff --git a/core/themes/claro/claro.libraries.yml b/core/themes/claro/claro.libraries.yml
index 3a66b925320b..ec413eef3ae0 100644
--- a/core/themes/claro/claro.libraries.yml
+++ b/core/themes/claro/claro.libraries.yml
@@ -71,12 +71,10 @@ global-styling:
     # such as inputs, action links, buttons, dropbuttons. For usability and
     # accessibility reasons, we keep target sizes big enough on touch screen
     # devices (by not making these elements smaller than their default size).
-    # Modernizr was used for recognizing whether user is using a touch device or
-    # not. This allows conditionally rendering small variation of the control
-    # elements on non-touch devices. Modernizr's touch detection has since been
-    # replaced by core/drupal.touchevents-test.
-    # In some cases, such as when rendering links, it is hard recognize when
-    # this detection should be attached, therefore it is always attached.
+    # This library allows conditionally rendering small variations of the
+    # control elements on non-touch devices. In some cases, such as when
+    # rendering links, it is hard to recognize when this detection should be
+    # attached, therefore it is always attached.
     - core/drupal.touchevents-test
 
 node-form:
diff --git a/core/themes/claro/templates/details.html.twig b/core/themes/claro/templates/details.html.twig
index dfd58d498592..1256f86e6b27 100644
--- a/core/themes/claro/templates/details.html.twig
+++ b/core/themes/claro/templates/details.html.twig
@@ -19,11 +19,6 @@
  * @see claro_preprocess_details()
  */
 #}
-{#
-  Prefix 'details' class to avoid collision with Modernizr.
-
-  @todo Remove prefix after https://www.drupal.org/node/2981732 has been solved.
-#}
 {%
   set classes = [
     'claro-details',
diff --git a/core/themes/claro/templates/navigation/details--vertical-tabs.html.twig b/core/themes/claro/templates/navigation/details--vertical-tabs.html.twig
index ba0d82325689..46328cb10f2c 100644
--- a/core/themes/claro/templates/navigation/details--vertical-tabs.html.twig
+++ b/core/themes/claro/templates/navigation/details--vertical-tabs.html.twig
@@ -20,11 +20,6 @@
  * @see claro_preprocess_details()
  */
 #}
-{#
-  Prefix 'details' class to avoid collision with Modernizr.
-
-  @todo Remove prefix after https://www.drupal.org/node/2981732 has been solved.
-#}
 {%
   set classes = [
     'claro-details',
diff --git a/core/themes/olivero/templates/form/details.html.twig b/core/themes/olivero/templates/form/details.html.twig
index c526d63e6ebe..c7a7f9c416a2 100644
--- a/core/themes/olivero/templates/form/details.html.twig
+++ b/core/themes/olivero/templates/form/details.html.twig
@@ -16,11 +16,6 @@
  * @see olivero_preprocess_details()
  */
 #}
-{#
-  Prefix 'details' class to avoid collision with Modernizr.
-
-  @todo Remove prefix after https://www.drupal.org/node/2981732 has been solved.
-#}
 {%
   set classes = [
     'olivero-details',
-- 
GitLab