diff --git a/core/includes/menu.inc b/core/includes/menu.inc index f754ecb9268..681bdbbd8f5 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -34,7 +34,7 @@ function template_preprocess_menu_local_task(&$variables) { $link_text = $link['title']; if (!empty($variables['element']['#active'])) { - $variables['attributes']['class'] = array('active'); + $variables['attributes']['class'] = array('is-active'); // Add text to indicate active tab for non-visual users. $active = SafeMarkup::format('@label', array('@label' => t('(active tab)'))); diff --git a/core/includes/tablesort.inc b/core/includes/tablesort.inc index 38cccc4af7d..65b791fc66c 100644 --- a/core/includes/tablesort.inc +++ b/core/includes/tablesort.inc @@ -48,7 +48,7 @@ function tablesort_header(&$cell_content, array &$cell_attributes, array $header // http://www.w3.org/TR/wai-aria/states_and_properties#aria-sort $cell_attributes['aria-sort'] = ($ts['sort'] == 'asc') ? 'ascending' : 'descending'; $ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc'); - $cell_attributes['class'][] = 'active'; + $cell_attributes['class'][] = 'is-active'; $tablesort_indicator = array( '#theme' => 'tablesort_indicator', '#style' => $ts['sort'], diff --git a/core/includes/theme.inc b/core/includes/theme.inc index dfee854c8a9..2aef832c819 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -549,7 +549,7 @@ function template_preprocess_datetime_wrapper(&$variables) { * list items differently when the link is active, since CSS does not yet allow * one to style list items only if it contains a certain element with a certain * class. I.e. we cannot yet convert this jQuery selector to a CSS selector: - * jQuery('li:has("a.active")') + * jQuery('li:has("a.is-active")') * * @see \Drupal\Core\Utility\LinkGenerator * @see \Drupal\Core\Utility\LinkGenerator::generate() @@ -1143,7 +1143,7 @@ function template_preprocess_maintenance_task_list(&$variables) { $variables['tasks'][$k]['item'] = $item; $variables['tasks'][$k]['attributes'] = new Attribute(); if ($active == $k) { - $variables['tasks'][$k]['attributes']->addClass('active'); + $variables['tasks'][$k]['attributes']->addClass('is-active'); $variables['tasks'][$k]['status'] = t('active'); $done = FALSE; } diff --git a/core/lib/Drupal/Core/Menu/LocalTaskDefault.php b/core/lib/Drupal/Core/Menu/LocalTaskDefault.php index 615eaa4ecc3..ecef19c5dae 100644 --- a/core/lib/Drupal/Core/Menu/LocalTaskDefault.php +++ b/core/lib/Drupal/Core/Menu/LocalTaskDefault.php @@ -113,8 +113,8 @@ class LocalTaskDefault extends PluginBase implements LocalTaskInterface { public function getOptions(RouteMatchInterface $route_match) { $options = $this->pluginDefinition['options']; if ($this->active) { - if (empty($options['attributes']['class']) || !in_array('active', $options['attributes']['class'])) { - $options['attributes']['class'][] = 'active'; + if (empty($options['attributes']['class']) || !in_array('is-active', $options['attributes']['class'])) { + $options['attributes']['class'][] = 'is-active'; } } return (array) $options; diff --git a/core/misc/active-link.js b/core/misc/active-link.js index 5bd12eba88d..c33c0ce6f68 100644 --- a/core/misc/active-link.js +++ b/core/misc/active-link.js @@ -8,7 +8,7 @@ "use strict"; /** - * Append active class. + * Append is-active class. * * The link is only active if its path corresponds to the current path, the * language of the linked path is equal to the current language, and if the @@ -16,8 +16,8 @@ * same request with different query parameters may yield a different page * (e.g. pagers, exposed View filters). * - * Does not discriminate based on element type, so allows you to set the active - * class on any element: a, li… + * Does not discriminate based on element type, so allows you to set the + * is-active class on any element: a, li… */ Drupal.behaviors.activeLinks = { attach: function (context) { @@ -47,14 +47,14 @@ // Query the DOM. var activeLinks = context.querySelectorAll(selectors.join(',')); for (var i = 0, il = activeLinks.length; i < il; i += 1) { - activeLinks[i].classList.add('active'); + activeLinks[i].classList.add('is-active'); } }, detach: function (context, settings, trigger) { if (trigger === 'unload') { - var activeLinks = context.querySelectorAll('[data-drupal-link-system-path].active'); + var activeLinks = context.querySelectorAll('[data-drupal-link-system-path].is-active'); for (var i = 0, il = activeLinks.length; i < il; i += 1) { - activeLinks[i].classList.remove('active'); + activeLinks[i].classList.remove('is-active'); } } } diff --git a/core/modules/contextual/css/contextual.icons.theme.css b/core/modules/contextual/css/contextual.icons.theme.css index 70363a78885..7eb3f43eeb6 100644 --- a/core/modules/contextual/css/contextual.icons.theme.css +++ b/core/modules/contextual/css/contextual.icons.theme.css @@ -10,7 +10,7 @@ background-image: url(../../../misc/icons/bebebe/pencil.svg); } .toolbar-bar .toolbar-icon-edit:active:before, -.toolbar-bar .toolbar-icon-edit.active:before { +.toolbar-bar .toolbar-icon-edit.is-active:before { background-image: url(../../../misc/icons/ffffff/pencil.svg); } diff --git a/core/modules/contextual/css/contextual.toolbar.css b/core/modules/contextual/css/contextual.toolbar.css index bda844c2664..3c82a1503a4 100644 --- a/core/modules/contextual/css/contextual.toolbar.css +++ b/core/modules/contextual/css/contextual.toolbar.css @@ -19,7 +19,7 @@ [dir="rtl"] .toolbar .toolbar-bar .contextual-toolbar-tab .toolbar-item { padding-right: 1.3333em; } -.toolbar .toolbar-bar .contextual-toolbar-tab .toolbar-item.active { +.toolbar .toolbar-bar .contextual-toolbar-tab .toolbar-item.is-active { background-image:-webkit-linear-gradient(rgb(78,159,234) 0%, rgb(69,132,221) 100%); background-image:linear-gradient(rgb(78,159,234) 0%,rgb(69,132,221) 100%); } diff --git a/core/modules/contextual/js/toolbar/views/VisualView.js b/core/modules/contextual/js/toolbar/views/VisualView.js index 9b444517c8b..41b095f36b5 100644 --- a/core/modules/contextual/js/toolbar/views/VisualView.js +++ b/core/modules/contextual/js/toolbar/views/VisualView.js @@ -44,7 +44,7 @@ // Render the visibility. this.$el.toggleClass('hidden', !this.model.get('isVisible')); // Render the state. - this.$el.find('button').toggleClass('active', !this.model.get('isViewing')); + this.$el.find('button').toggleClass('is-active', !this.model.get('isViewing')); return this; }, diff --git a/core/modules/language/src/Tests/LanguageSwitchingTest.php b/core/modules/language/src/Tests/LanguageSwitchingTest.php index 1c39a8854ac..c9ff8d06638 100644 --- a/core/modules/language/src/Tests/LanguageSwitchingTest.php +++ b/core/modules/language/src/Tests/LanguageSwitchingTest.php @@ -140,14 +140,14 @@ class LanguageSwitchingTest extends WebTestBase { foreach ($language_switcher->ul->li as $link) { $classes = explode(" ", (string) $link['class']); list($langcode) = array_intersect($classes, array('en', 'fr')); - if (in_array('active', $classes)) { + if (in_array('is-active', $classes)) { $links['active'][] = $langcode; } else { $links['inactive'][] = $langcode; } $anchor_classes = explode(" ", (string) $link->a['class']); - if (in_array('active', $anchor_classes)) { + if (in_array('is-active', $anchor_classes)) { $anchors['active'][] = $langcode; } else { @@ -359,17 +359,17 @@ class LanguageSwitchingTest extends WebTestBase { // Language code 'none' link should be active. $langcode = 'none'; - $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', array(':id' => 'no_lang_link', ':class' => 'active')); + $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', array(':id' => 'no_lang_link', ':class' => 'is-active')); $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is marked active.', array(':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode))); // Language code 'en' link should be active. $langcode = 'en'; - $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', array(':id' => 'en_link', ':class' => 'active')); + $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', array(':id' => 'en_link', ':class' => 'is-active')); $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is marked active.', array(':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode))); // Language code 'fr' link should not be active. $langcode = 'fr'; - $links = $this->xpath('//a[@id = :id and not(contains(@class, :class))]', array(':id' => 'fr_link', ':class' => 'active')); + $links = $this->xpath('//a[@id = :id and not(contains(@class, :class))]', array(':id' => 'fr_link', ':class' => 'is-active')); $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is NOT marked active.', array(':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode))); // Test links generated by _l() on a French page. @@ -378,17 +378,17 @@ class LanguageSwitchingTest extends WebTestBase { // Language code 'none' link should be active. $langcode = 'none'; - $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', array(':id' => 'no_lang_link', ':class' => 'active')); + $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', array(':id' => 'no_lang_link', ':class' => 'is-active')); $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is marked active.', array(':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode))); // Language code 'en' link should not be active. $langcode = 'en'; - $links = $this->xpath('//a[@id = :id and not(contains(@class, :class))]', array(':id' => 'en_link', ':class' => 'active')); + $links = $this->xpath('//a[@id = :id and not(contains(@class, :class))]', array(':id' => 'en_link', ':class' => 'is-active')); $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is NOT marked active.', array(':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode))); // Language code 'fr' link should be active. $langcode = 'fr'; - $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', array(':id' => 'fr_link', ':class' => 'active')); + $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', array(':id' => 'fr_link', ':class' => 'is-active')); $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is marked active.', array(':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode))); } diff --git a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php index 44bfdabb7c1..5cc97131a3c 100644 --- a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php @@ -402,7 +402,7 @@ class LanguageUILanguageNegotiationTest extends WebTestBase { // Check that the language switcher active link matches the given browser // language. $args = array(':id' => 'block-test-language-block', ':url' => \Drupal::url('') . $langcode_browser_fallback); - $fields = $this->xpath('//div[@id=:id]//a[@class="language-link active" and starts-with(@href, :url)]', $args); + $fields = $this->xpath('//div[@id=:id]//a[@class="language-link is-active" and starts-with(@href, :url)]', $args); $this->assertTrue($fields[0] == $languages[$langcode_browser_fallback]->getName(), 'The browser language is the URL active language'); // Check that URLs are rewritten using the given browser language. diff --git a/core/modules/shortcut/css/shortcut.icons.theme.css b/core/modules/shortcut/css/shortcut.icons.theme.css index e15f7d8141d..54569c2e48d 100644 --- a/core/modules/shortcut/css/shortcut.icons.theme.css +++ b/core/modules/shortcut/css/shortcut.icons.theme.css @@ -10,7 +10,7 @@ background-image: url(../../../misc/icons/bebebe/star.svg); } .toolbar-bar .toolbar-icon-shortcut:active:before, -.toolbar-bar .toolbar-icon-shortcut.active:before { +.toolbar-bar .toolbar-icon-shortcut.is-active:before { background-image: url(../../../misc/icons/ffffff/star.svg); } diff --git a/core/modules/system/css/system.theme.css b/core/modules/system/css/system.theme.css index f7af1e4eb04..0f5b08fdd16 100644 --- a/core/modules/system/css/system.theme.css +++ b/core/modules/system/css/system.theme.css @@ -13,10 +13,10 @@ /** * Markup generated by tablesort-indicator.html.twig. */ -th.active img { +th.is-active img { display: inline; } -td.active { +td.is-active { background-color: #ddd; } @@ -361,7 +361,7 @@ ul.menu { padding-top: 0.2em; margin: 0; } -ul.menu a.active { +ul.menu a.is-active { color: #000; } @@ -378,7 +378,7 @@ ul.inline li { list-style-type: none; padding: 0 0.5em; } -ul.links a.active { +ul.links a.is-active { color: #000; } @@ -434,7 +434,7 @@ ul.tabs { padding: 0.2em 1em; text-decoration: none; } -.tabs a.active { +.tabs a.is-active { background-color: #eee; } .tabs a:focus, diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php index 73180a08761..90c260cf28a 100644 --- a/core/modules/system/src/Controller/SystemController.php +++ b/core/modules/system/src/Controller/SystemController.php @@ -329,7 +329,7 @@ class SystemController extends ControllerBase { } /** - * #post_render_cache callback; sets the "active" class on relevant links. + * #post_render_cache callback; sets the "is-active" class on relevant links. * * This is a PHP implementation of the drupal.active-link JavaScript library. * @@ -405,7 +405,7 @@ class SystemController extends ControllerBase { // Ensure we don't set the "active" class twice on the same element. $class = $node->getAttribute('class'); - $add_active = !in_array('active', explode(' ', $class)); + $add_active = !in_array('is-active', explode(' ', $class)); // The language of an active link is equal to the current language. if ($add_active && $context['language']) { @@ -429,12 +429,12 @@ class SystemController extends ControllerBase { } // Only if the path, the language and the query match, we set the - // "active" class. + // "is-active" class. if ($add_active) { if (strlen($class) > 0) { $class .= ' '; } - $class .= 'active'; + $class .= 'is-active'; $node->setAttribute('class', $class); // Get the updated tag. diff --git a/core/modules/system/src/Tests/Common/UrlTest.php b/core/modules/system/src/Tests/Common/UrlTest.php index ad97b93efe0..38641c1edd1 100644 --- a/core/modules/system/src/Tests/Common/UrlTest.php +++ b/core/modules/system/src/Tests/Common/UrlTest.php @@ -87,20 +87,20 @@ class UrlTest extends WebTestBase { $path = 'common-test/type-link-active-class'; $this->drupalGet($path, $options_no_query); - $links = $this->xpath('//a[@href = :href and contains(@class, :class)]', array(':href' => Url::fromRoute('common_test.l_active_class', [], $options_no_query)->toString(), ':class' => 'active')); + $links = $this->xpath('//a[@href = :href and contains(@class, :class)]', array(':href' => Url::fromRoute('common_test.l_active_class', [], $options_no_query)->toString(), ':class' => 'is-active')); $this->assertTrue(isset($links[0]), 'A link generated by _l() to the current page is marked active.'); - $links = $this->xpath('//a[@href = :href and not(contains(@class, :class))]', array(':href' => Url::fromRoute('common_test.l_active_class', [], $options_query)->toString(), ':class' => 'active')); + $links = $this->xpath('//a[@href = :href and not(contains(@class, :class))]', array(':href' => Url::fromRoute('common_test.l_active_class', [], $options_query)->toString(), ':class' => 'is-active')); $this->assertTrue(isset($links[0]), 'A link generated by _l() to the current page with a query string when the current page has no query string is not marked active.'); $this->drupalGet($path, $options_query); - $links = $this->xpath('//a[@href = :href and contains(@class, :class)]', array(':href' => Url::fromRoute('common_test.l_active_class', [], $options_query)->toString(), ':class' => 'active')); + $links = $this->xpath('//a[@href = :href and contains(@class, :class)]', array(':href' => Url::fromRoute('common_test.l_active_class', [], $options_query)->toString(), ':class' => 'is-active')); $this->assertTrue(isset($links[0]), 'A link generated by _l() to the current page with a query string that matches the current query string is marked active.'); - $links = $this->xpath('//a[@href = :href and contains(@class, :class)]', array(':href' => Url::fromRoute('common_test.l_active_class', [], $options_query_reverse)->toString(), ':class' => 'active')); + $links = $this->xpath('//a[@href = :href and contains(@class, :class)]', array(':href' => Url::fromRoute('common_test.l_active_class', [], $options_query_reverse)->toString(), ':class' => 'is-active')); $this->assertTrue(isset($links[0]), 'A link generated by _l() to the current page with a query string that has matching parameters to the current query string but in a different order is marked active.'); - $links = $this->xpath('//a[@href = :href and not(contains(@class, :class))]', array(':href' => Url::fromRoute('common_test.l_active_class', [], $options_no_query)->toString(), ':class' => 'active')); + $links = $this->xpath('//a[@href = :href and not(contains(@class, :class))]', array(':href' => Url::fromRoute('common_test.l_active_class', [], $options_no_query)->toString(), ':class' => 'is-active')); $this->assertTrue(isset($links[0]), 'A link generated by _l() to the current page without a query string when the current page has a query string is not marked active.'); // Test adding a custom class in links produced by _l() and #type 'link'. diff --git a/core/modules/system/src/Tests/Menu/AssertMenuActiveTrailTrait.php b/core/modules/system/src/Tests/Menu/AssertMenuActiveTrailTrait.php index fba46d470ad..125246ca207 100644 --- a/core/modules/system/src/Tests/Menu/AssertMenuActiveTrailTrait.php +++ b/core/modules/system/src/Tests/Menu/AssertMenuActiveTrailTrait.php @@ -56,7 +56,7 @@ trait AssertMenuActiveTrailTrait { $xpath .= 'li[contains(@class, :class-trail)]/a[contains(@href, :href) ' . $xpath_last_active . 'and contains(text(), :title)]'; $args = array( ':class-trail' => 'menu-item--active-trail', - ':class-active' => 'active', + ':class-active' => 'is-active', ':href' => Url::fromUri('base:' . $active_link_path)->toString(), ':title' => $active_link_title, ); diff --git a/core/modules/system/tests/src/Unit/Controller/SystemControllerTest.php b/core/modules/system/tests/src/Unit/Controller/SystemControllerTest.php index c719a6ab7c4..173a4300929 100644 --- a/core/modules/system/tests/src/Unit/Controller/SystemControllerTest.php +++ b/core/modules/system/tests/src/Unit/Controller/SystemControllerTest.php @@ -25,10 +25,10 @@ class SystemControllerTest extends UnitTestCase { * @see \Drupal\system\Controller\SystemController::setLinkActiveClass() */ public function providerTestSetLinkActiveClass() { - // Define all the variations that *don't* affect whether or not an "active" - // class is set, but that should remain unchanged: + // Define all the variations that *don't* affect whether or not an + // "is-active" class is set, but that should remain unchanged: // - surrounding HTML - // - tags for which to test the setting of the "active" class + // - tags for which to test the setting of the "is-active" class // - content of said tags $edge_case_html5 = '