6.1 KiB
6.1 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d778b367417b2b2512aa7 | Wrap Radio Buttons in a fieldset Element for Better Accessibility | 0 | Envuelva los botones de radio en un elemento fieldset para una mejor accesibilidad |
Description
label
con un atributo for
vincula con el id
del elemento correspondiente tal como se describe en el último desafío. Dado que los botones de radio a menudo vienen en un grupo donde el usuario debe elegir uno, hay una manera de mostrar semánticamente que las opciones son parte de un conjunto. La etiqueta fieldset
rodea todo el grupo de botones de radio para lograr esto. A menudo utiliza una etiqueta de legend
para proporcionar una descripción de la agrupación, que los lectores de pantalla leen para cada opción en el elemento fieldset
. El fieldset
y la etiqueta de legend
no son necesarios cuando las opciones se explican por sí mismas, como una selección de género. Usando una label
con el for
atributo para cada botón de radio es suficiente. Aquí hay un ejemplo: <form>
<fieldset>
<legend> Elija uno de estos tres elementos: </legend>
<input id = "one" type = "radio" name = "items" value = "one">
<label for = "one"> Choice One </label> <br>
<input id = "two" type = "radio" name = "items" value = "two">
<label for = "two"> Choice Two </label> <br>
<input id = "three" type = "radio" name = "items" value = "three">
<label for = "three"> Choice Three </label>
</fieldset>
</form>
Instructions
for
atributos para cada elección. ¡Ve el gato campista! Sin embargo, su código todavía necesita ayuda. Cambie la etiqueta div
rodea a los botones de fieldset
una etiqueta de conjunto de fieldset
y cambie la etiqueta p
dentro de una legend
. Tests
tests:
- text: El código debe tener un <code>fieldset</code> de etiqueta en todo el juego de botones circulares.
testString: 'assert($("fieldset").length == 1, "Your code should have a <code>fieldset</code> tag around the radio button set.");'
- text: Asegúrese de que su elemento <code>fieldset</code> tenga una etiqueta de cierre.
testString: 'assert(code.match(/<\/fieldset>/g) && code.match(/<\/fieldset>/g).length === code.match(/<fieldset>/g).length, "Make sure your <code>fieldset</code> element has a closing tag.");'
- text: Tu código debe tener una etiqueta de <code>legend</code> alrededor del texto que pregunta qué nivel de ninja es un usuario.
testString: 'assert($("legend").length == 1, "Your code should have a <code>legend</code> tag around the text asking what level ninja a user is.");'
- text: Su código no debe tener ninguna etiqueta <code>div</code> .
testString: 'assert($("div").length == 0, "Your code should not have any <code>div</code> tags.");'
- text: Tu código ya no debería tener una etiqueta <code>p</code> alrededor del texto que pregunta qué nivel de ninja es un usuario.
testString: 'assert($("p").length == 4, "Your code should no longer have a <code>p</code> tag around the text asking what level ninja a user is.");'
Challenge Seed
<body>
<header>
<h1>Deep Thoughts with Master Camper Cat</h1>
</header>
<section>
<form>
<p>Sign up to receive Camper Cat's blog posts by email here!</p>
<label for="email">Email:</label>
<input type="text" id="email" name="email">
<!-- Add your code below this line -->
<div>
<p>What level ninja are you?</p>
<input id="newbie" type="radio" name="levels" value="newbie">
<label for="newbie">Newbie Kitten</label><br>
<input id="intermediate" type="radio" name="levels" value="intermediate">
<label for="intermediate">Developing Student</label><br>
<input id="master" type="radio" name="levels" value="master">
<label for="master">Master</label>
</div>
<!-- Add your code above this line -->
<input type="submit" name="submit" value="Submit">
</form>
</section>
<article>
<h2>The Garfield Files: Lasagna as Training Fuel?</h2>
<p>The internet is littered with varying opinions on nutritional paradigms, from catnip paleo to hairball cleanses. But let's turn our attention to an often overlooked fitness fuel, and examine the protein-carb-NOM trifecta that is lasagna...</p>
</article>
<img src="samuraiSwords.jpeg" alt="">
<article>
<h2>Defeating your Foe: the Red Dot is Ours!</h2>
<p>Felines the world over have been waging war on the most persistent of foes. This red nemesis combines both cunning stealth and lightening speed. But chin up, fellow fighters, our time for victory may soon be near...</p>
</article>
<img src="samuraiSwords.jpeg" alt="">
<article>
<h2>Is Chuck Norris a Cat Person?</h2>
<p>Chuck Norris is widely regarded as the premier martial artist on the planet, and it's a complete coincidence anyone who disagrees with this fact mysteriously disappears soon after. But the real question is, is he a cat person?...</p>
</article>
<footer>© 2018 Camper Cat</footer>
</body>
Solution
// solution required