diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 131e4f6..42ec424 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -715,7 +715,7 @@ function template_preprocess_links(&$variables) {
           $link_element['#options']['set_active_class'] = TRUE;
 
           if (!empty($link['language'])) {
-            $li_attributes['hreflang'] = $link['language']->getId();
+            $li_attributes['data-drupal-language'] = $link['language']->getId();
           }
 
           // Add a "data-drupal-link-query" attribute to let the
diff --git a/core/lib/Drupal/Core/EventSubscriber/ActiveLinkResponseFilter.php b/core/lib/Drupal/Core/EventSubscriber/ActiveLinkResponseFilter.php
index b32cf84..dcd5545 100644
--- a/core/lib/Drupal/Core/EventSubscriber/ActiveLinkResponseFilter.php
+++ b/core/lib/Drupal/Core/EventSubscriber/ActiveLinkResponseFilter.php
@@ -187,7 +187,10 @@ public static function setLinkActiveClass($html_markup, $current_path, $is_front
 
       // The language of an active link is equal to the current language.
       if ($add_active && $url_language) {
-        if ($node->hasAttribute('hreflang') && $node->getAttribute('hreflang') !== $url_language) {
+        if ($node->nodeName === 'li' && $node->hasAttribute('data-drupal-language') && $node->getAttribute('data-drupal-language') !== $url_language) {
+          $add_active = FALSE;
+        }
+        if ($node->nodeName !== 'li' && $node->hasAttribute('hreflang') && $node->getAttribute('hreflang') !== $url_language) {
           $add_active = FALSE;
         }
       }
diff --git a/core/misc/active-link.es6.js b/core/misc/active-link.es6.js
index fd95376..390a89d 100644
--- a/core/misc/active-link.es6.js
+++ b/core/misc/active-link.es6.js
@@ -41,10 +41,15 @@
       selectors = [].concat(
         // Links without any hreflang attributes (most of them).
         originalSelectors.map(selector => `${selector}:not([hreflang])`),
-        // Links with hreflang equals to the current language.
+        // Links li with data-drupal-language equals to the current language.
         originalSelectors.map(
-          selector => `${selector}[hreflang="${path.currentLanguage}"]`,
+          selector => `li${selector}[data-drupal-language="${path.currentLanguage}"]`,
         ),
+        // Links a with hreflang equals to the current language.
+        originalSelectors.map(
+          selector => `a${selector}[hreflang="${path.currentLanguage}"]`,
+        ),
+
       );
 
       // Add query string selector for pagers, exposed filters.
diff --git a/core/misc/active-link.js b/core/misc/active-link.js
index 6965121..a7a5efa 100644
--- a/core/misc/active-link.js
+++ b/core/misc/active-link.js
@@ -19,9 +19,11 @@
       }
 
       selectors = [].concat(originalSelectors.map(function (selector) {
-        return selector + ':not([hreflang])';
+        return selector + ':not([data-drupal-language]):not([hreflang])';
       }), originalSelectors.map(function (selector) {
-        return selector + '[hreflang="' + path.currentLanguage + '"]';
+        return 'li' + selector + '[data-drupal-language="' + path.currentLanguage + '"]';
+      }), originalSelectors.map(function (selector) {
+        return 'a' + selector + '[hreflang="' + path.currentLanguage + '"]';
       }));
 
       selectors = selectors.map(function (current) {
