summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2013-10-21 09:26:54 (GMT)
committerAlex Pott2013-10-21 09:26:54 (GMT)
commit91d867f5bc04b7760a4d17f431f79aea3392716c (patch)
treeb62ef11b9ae75660c0d17d9e83c39b718a3a902a
parentf5a948f83342f71eba436836dcc704379994f96e (diff)
Issue #1982256 by mortendk, rteijeiro, tim.plunkett, LewisNyman, tlattimore, yannickoo, ry5n: Clean up html.html.twig markup.
-rw-r--r--core/includes/theme.inc21
-rw-r--r--core/modules/node/node.module10
-rw-r--r--core/modules/overlay/css/overlay-child.css2
-rw-r--r--core/modules/system/templates/html.html.twig8
-rw-r--r--core/themes/bartik/bartik.theme16
-rw-r--r--core/themes/bartik/css/style.css19
-rw-r--r--core/themes/bartik/templates/maintenance-page.html.twig6
-rw-r--r--core/themes/seven/seven.theme14
-rw-r--r--core/themes/seven/style.css22
9 files changed, 68 insertions, 50 deletions
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index e49bb76..1d24dd5 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2511,22 +2511,6 @@ function template_preprocess_html(&$variables) {
// Add a class that tells us whether the page is viewed by an authenticated user or not.
$variables['attributes']['class'][] = $variables['logged_in'] ? 'logged-in' : 'not-logged-in';
- // Add information about the number of sidebars.
- if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
- $variables['attributes']['class'][] = 'two-sidebars';
- }
- elseif (!empty($variables['page']['sidebar_first'])) {
- $variables['attributes']['class'][] = 'one-sidebar';
- $variables['attributes']['class'][] = 'sidebar-first';
- }
- elseif (!empty($variables['page']['sidebar_second'])) {
- $variables['attributes']['class'][] = 'one-sidebar';
- $variables['attributes']['class'][] = 'sidebar-second';
- }
- else {
- $variables['attributes']['class'][] = 'no-sidebars';
- }
-
// Populate the body classes.
if ($suggestions = theme_get_suggestions(arg(), 'page', '-')) {
foreach ($suggestions as $suggestion) {
@@ -2539,11 +2523,6 @@ function template_preprocess_html(&$variables) {
}
}
- // If on an individual node page, add the node type to body classes.
- if ($node = menu_get_object()) {
- $variables['attributes']['class'][] = drupal_html_class('node-type-' . $node->getType());
- }
-
// Initializes attributes which are specific to the html and body elements.
$variables['html_attributes'] = new Attribute;
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 0ad789d..ed31eea 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -578,6 +578,16 @@ function node_is_page(EntityInterface $node) {
}
/**
+ * Implements hook_preprocess_HOOK() for HTML document templates.
+ */
+function node_preprocess_html(&$variables) {
+ // If on an individual node page, add the node type to body classes.
+ if ($node = menu_get_object()) {
+ $variables['attributes']['class'][] = drupal_html_class('node-type-' . $node->getType());
+ }
+}
+
+/**
* Implements hook_preprocess_HOOK() for block templates.
*/
function node_preprocess_block(&$variables) {
diff --git a/core/modules/overlay/css/overlay-child.css b/core/modules/overlay/css/overlay-child.css
index 8162d5b..b40e3af 100644
--- a/core/modules/overlay/css/overlay-child.css
+++ b/core/modules/overlay/css/overlay-child.css
@@ -63,7 +63,7 @@ html[dir="rtl"] {
#overlay-title:focus {
outline: 0;
}
-.overlay #skip-link a {
+.overlay .skip-link {
color: #fff; /* This is white to contrast with the dark background behind it. */
}
diff --git a/core/modules/system/templates/html.html.twig b/core/modules/system/templates/html.html.twig
index 6bdbe87..209b914 100644
--- a/core/modules/system/templates/html.html.twig
+++ b/core/modules/system/templates/html.html.twig
@@ -35,11 +35,9 @@
{{ scripts }}
</head>
<body{{ attributes }}>
- <div id="skip-link">
- <a href="#main-content" class="visually-hidden focusable">
- {{ 'Skip to main content'|t }}
- </a>
- </div>
+ <a href="#main-content" class="visually-hidden focusable skip-link">
+ {{ 'Skip to main content'|t }}
+ </a>
{{ page_top }}
{{ page }}
{{ page_bottom }}
diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme
index 593923a..4a56b7d 100644
--- a/core/themes/bartik/bartik.theme
+++ b/core/themes/bartik/bartik.theme
@@ -13,6 +13,22 @@ use Drupal\Core\Template\RenderWrapper;
* Adds body classes if certain regions have content.
*/
function bartik_preprocess_html(&$variables) {
+ // Add information about the number of sidebars.
+ if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
+ $variables['attributes']['class'][] = 'two-sidebars';
+ }
+ elseif (!empty($variables['page']['sidebar_first'])) {
+ $variables['attributes']['class'][] = 'one-sidebar';
+ $variables['attributes']['class'][] = 'sidebar-first';
+ }
+ elseif (!empty($variables['page']['sidebar_second'])) {
+ $variables['attributes']['class'][] = 'one-sidebar';
+ $variables['attributes']['class'][] = 'sidebar-second';
+ }
+ else {
+ $variables['attributes']['class'][] = 'no-sidebars';
+ }
+
if (!empty($variables['page']['featured'])) {
$variables['attributes']['class'][] = 'featured';
}
diff --git a/core/themes/bartik/css/style.css b/core/themes/bartik/css/style.css
index eaa3061..5dad110 100644
--- a/core/themes/bartik/css/style.css
+++ b/core/themes/bartik/css/style.css
@@ -114,7 +114,7 @@ body,
}
#header,
#footer-wrapper,
-#skip-link,
+.skip-link,
ul.contextual-links,
ul.links,
ul.primary,
@@ -315,17 +315,18 @@ ul.tips {
}
/* ------------------ Header ------------------ */
-#skip-link {
+.skip-link,
+.skip-link.visually-hidden.focusable {
left: 50%;
margin-left: -5.25em;
margin-top: 0;
- position: absolute;
+ position: absolute !important;
width: auto;
z-index: 50;
}
-#skip-link a,
-#skip-link a:link,
-#skip-link a:visited {
+.skip-link,
+.skip-link:link,
+.skip-link:visited {
background: #444;
background: rgba(0, 0, 0, 0.6);
color: #fff;
@@ -336,9 +337,9 @@ ul.tips {
text-decoration: none;
border-radius: 0 0 10px 10px;
}
-#skip-link a:hover,
-#skip-link a:active,
-#skip-link a:focus {
+.skip-link:hover,
+.skip-link:active,
+.skip-link:focus {
outline: 0;
}
#logo {
diff --git a/core/themes/bartik/templates/maintenance-page.html.twig b/core/themes/bartik/templates/maintenance-page.html.twig
index 083c401..031f073 100644
--- a/core/themes/bartik/templates/maintenance-page.html.twig
+++ b/core/themes/bartik/templates/maintenance-page.html.twig
@@ -20,9 +20,9 @@
</head>
<body class="{{ attributes.class }}"{{ attributes }}>
- <div id="skip-link">
- <a href="#main-content" class="visually-hidden focusable">{{ 'Skip to main content'|t }}</a>
- </div>
+ <a href="#main-content" class="visually-hidden focusable skip-link">
+ {{ 'Skip to main content'|t }}
+ </a>
<div id="page-wrapper"><div id="page">
diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme
index 29f1711..67ebb0f 100644
--- a/core/themes/seven/seven.theme
+++ b/core/themes/seven/seven.theme
@@ -31,6 +31,20 @@ function seven_library_info() {
}
/**
+ * Implements hook_preprocess_HOOK() for HTML document templates.
+ */
+function seven_preprocess_html(&$variables) {
+ // Add information about the number of sidebars.
+ if (!empty($variables['page']['sidebar_first'])) {
+ $variables['attributes']['class'][] = 'one-sidebar';
+ $variables['attributes']['class'][] = 'sidebar-first';
+ }
+ else {
+ $variables['attributes']['class'][] = 'no-sidebars';
+ }
+}
+
+/**
* Implements hook_preprocess_HOOK() for page templates.
*/
function seven_preprocess_page(&$variables) {
diff --git a/core/themes/seven/style.css b/core/themes/seven/style.css
index 69ef6ec..5866808 100644
--- a/core/themes/seven/style.css
+++ b/core/themes/seven/style.css
@@ -158,7 +158,7 @@ pre {
/**
* Skip link.
*/
-#skip-link {
+.skip-link {
margin-top: 0;
position: absolute;
left: 50%; /* LTR */
@@ -166,13 +166,13 @@ pre {
width: auto;
z-index: 50;
}
-[dir="rtl"] #skip-link {
+[dir="rtl"] .skip-link {
right: 50%;
margin-right: -5.25em;
}
-#skip-link a,
-#skip-link a:link,
-#skip-link a:visited {
+.skip-link,
+.skip-link:link,
+.skip-link:visited {
display: inline-block;
background: #444;
color: #fff;
@@ -181,14 +181,14 @@ pre {
text-decoration: none;
border-radius: 0 0 10px 10px;
}
-[dir="rtl"] #skip-link a,
-[dir="rtl"] #skip-link a:link,
-[dir="rtl"] #skip-link a:visited {
+[dir="rtl"] .skip-link,
+[dir="rtl"] .skip-link:link,
+[dir="rtl"] .skip-link:visited {
padding: 1px 10px 2px 10px;
}
-#skip-link a:hover,
-#skip-link a:focus,
-#skip-link a:active {
+.skip-link:hover,
+.skip-link:focus,
+.skip-link:active {
outline: 0;
}