Permalink
Browse files

Use aria-current also in built in site profiles

  • Loading branch information...
marcus-herrmann committed Nov 27, 2016
1 parent 7038b78 commit 016290192fd96d359223e99a42c32fd93a226731
@@ -30,7 +30,7 @@ function renderNav(PageArray $items) {
// render markup for each navigation item as an <li>
if($item->id == wire('page')->id) {
// if current item is the same as the page being viewed, add a "current" class to it
echo "<li class='current'>";
echo "<li class='current' aria-current='true'>";
} else {
// otherwise just a regular list item
echo "<li>";
@@ -76,7 +76,7 @@ function renderNavTree($items, $maxDepth = 3) {
// if current item is the same as the page being viewed, add a "current" class and
// visually hidden text for screen readers to it
if($item->id == wire('page')->id) {
echo "<li class='current'><span class='visually-hidden'>Current page: </span>";
echo "<li class='current' aria-current='true'><span class='visually-hidden'>Current page: </span>";
} else {
echo "<li>";
}
@@ -25,7 +25,7 @@
if($child->id == $page->rootParent->id) {
// this $child page is currently being viewed (or one of it's children/descendents)
// so we highlight it as the current page in the navigation
echo "<li class='current'><span class='visually-hidden'>Current page: </span><a href='$child->url'>$child->title</a></li>";
echo "<li class='current' aria-current='true'><span class='visually-hidden'>Current page: </span><a href='$child->url'>$child->title</a></li>";
} else {
echo "<li><a href='$child->url'>$child->title</a></li>";
}
@@ -64,9 +64,10 @@
if ($child === $page->rootParent) {
$class = " class='on'";
$indicator = "<span class='visually-hidden'>Current page: </span>";
$ariaState = " aria-current='true' ";
}
$class = $child === $page->rootParent ? " class='on'" : '';
echo "<li><a$class href='{$child->url}'>$indicator{$child->title}</a></li>";
echo "<li><a$class$ariaState href='{$child->url}'>$indicator{$child->title}</a></li>";
}
?></ul>
@@ -140,7 +141,8 @@
foreach($page->rootParent->children as $child) {
$class = $page === $child ? " class='on'" : '';
echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>";
$ariaState = $page === $child ? " aria-current='true' " : '';
echo "<li><a$class$ariaState href='{$child->url}'>{$child->title}</a></li>";
}
echo "</ul>";
@@ -48,7 +48,7 @@
// top navigation consists of homepage and its visible children
foreach($homepage->and($homepage->children) as $item) {
if($item->id == $page->rootParent->id) {
echo "<li class='current'><span class='visually-hidden'>Current page: </span>";
echo "<li class='current' aria-current='true'><span class='visually-hidden'>Current page: </span>";
} else {
echo "<li>";
}
@@ -82,7 +82,7 @@
// top navigation consists of homepage and its visible children
foreach($homepage->and($homepage->children) as $item) {
if($item->id == $page->rootParent->id) {
echo "<li class='current'><span class='visually-hidden'>" . _x('Current page:', 'navigation') . " </span>";
echo "<li class='current' aria-current='true'><span class='visually-hidden'>" . _x('Current page:', 'navigation') . " </span>";
} else {
echo "<li>";
}

0 comments on commit 0162901

Please sign in to comment.