122 lines
3.4 KiB
Markdown
122 lines
3.4 KiB
Markdown
---
|
|
id: 587d7788367417b2b2512aa2
|
|
title: Make Screen Reader Navigation Easier with the nav Landmark
|
|
challengeType: 0
|
|
videoUrl: 'https://scrimba.com/c/czVwWSv'
|
|
forumTopicId: 301024
|
|
dashedName: make-screen-reader-navigation-easier-with-the-nav-landmark
|
|
---
|
|
|
|
# --description--
|
|
|
|
The `nav` element is another HTML5 item with the embedded landmark feature for easy screen reader navigation. This tag is meant to wrap around the main navigation links in your page.
|
|
|
|
If there are repeated site links at the bottom of the page, it isn't necessary to markup those with a `nav` tag as well. Using a `footer` (covered in the next challenge) is sufficient.
|
|
|
|
# --instructions--
|
|
|
|
Camper Cat included navigation links at the top of his training page, but wrapped them in a `div`. Change the `div` to a `nav` tag to improve the accessibility on his page.
|
|
|
|
# --hints--
|
|
|
|
Your code should have one `nav` tag.
|
|
|
|
```js
|
|
assert($('nav').length == 1);
|
|
```
|
|
|
|
Your `nav` tags should wrap around the `ul` and its list items.
|
|
|
|
```js
|
|
assert($('nav').children('ul').length == 1);
|
|
```
|
|
|
|
Your code should not have any `div` tags.
|
|
|
|
```js
|
|
assert($('div').length == 0);
|
|
```
|
|
|
|
Your `nav` element should have a closing tag.
|
|
|
|
```js
|
|
assert(
|
|
code.match(/<\/nav>/g) &&
|
|
code.match(/<\/nav>/g).length === code.match(/<nav>/g).length
|
|
);
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```html
|
|
<body>
|
|
<header>
|
|
<h1>Training with Camper Cat</h1>
|
|
|
|
<div>
|
|
<ul>
|
|
<li><a href="#stealth">Stealth & Agility</a></li>
|
|
<li><a href="#combat">Combat</a></li>
|
|
<li><a href="#weapons">Weapons</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
</header>
|
|
<main>
|
|
<section id="stealth">
|
|
<h2>Stealth & Agility Training</h2>
|
|
<article><h3>Climb foliage quickly using a minimum spanning tree approach</h3></article>
|
|
<article><h3>No training is NP-complete without parkour</h3></article>
|
|
</section>
|
|
<section id="combat">
|
|
<h2>Combat Training</h2>
|
|
<article><h3>Dispatch multiple enemies with multithreaded tactics</h3></article>
|
|
<article><h3>Goodbye world: 5 proven ways to knock out an opponent</h3></article>
|
|
</section>
|
|
<section id="weapons">
|
|
<h2>Weapons Training</h2>
|
|
<article><h3>Swords: the best tool to literally divide and conquer</h3></article>
|
|
<article><h3>Breadth-first or depth-first in multi-weapon training?</h3></article>
|
|
</section>
|
|
</main>
|
|
</body>
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```html
|
|
<body>
|
|
<header>
|
|
<h1>Training with Camper Cat</h1>
|
|
|
|
<nav>
|
|
<ul>
|
|
<li><a href="#stealth">Stealth & Agility</a></li>
|
|
<li><a href="#combat">Combat</a></li>
|
|
<li><a href="#weapons">Weapons</a></li>
|
|
</ul>
|
|
</nav>
|
|
|
|
</header>
|
|
<main>
|
|
<section id="stealth">
|
|
<h2>Stealth & Agility Training</h2>
|
|
<article><h3>Climb foliage quickly using a minimum spanning tree approach</h3></article>
|
|
<article><h3>No training is NP-complete without parkour</h3></article>
|
|
</section>
|
|
<section id="combat">
|
|
<h2>Combat Training</h2>
|
|
<article><h3>Dispatch multiple enemies with multithreaded tactics</h3></article>
|
|
<article><h3>Goodbye world: 5 proven ways to knock out an opponent</h3></article>
|
|
</section>
|
|
<section id="weapons">
|
|
<h2>Weapons Training</h2>
|
|
<article><h3>Swords: the best tool to literally divide and conquer</h3></article>
|
|
<article><h3>Breadth-first or depth-first in multi-weapon training?</h3></article>
|
|
</section>
|
|
</main>
|
|
</body>
|
|
```
|