Files
2022-04-05 16:51:38 +05:30

3.9 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
587d7790367417b2b2512aaf HTML アクセスキーでリンクをナビゲーション可能にする 0 https://scrimba.com/c/cQvmaTp 301021 make-links-navigable-with-html-access-keys

--description--

HTML は要素をアクティブ化したりフォーカスを与えるショートカットキーを指定する accesskey 属性を提供します。 accesskey 属性を追加することで、キーボードだけを使用するユーザーのナビゲーションがより効率的になります。

HTML5 ではこの属性を任意の要素に使用することができますが、これを対話型の要素に使用すると特に有益です。 これにはリンク、ボタン、フォームコントロールが含まれます。

例:

<button accesskey="b">Important Button</button>

--instructions--

Camper Cat は、2 つのブログ記事タイトル周りのリンクがキーボードショートカットを持つことで、サイトのユーザーがすぐに記事全体のページへ移動できるようにしたいと思っています。 両方のリンクに accesskey 属性を追加し、1 番目のものに g (Garfield の g) に、2 番目のものに c (Chuck Norris の c) を設定します。

--hints--

コードは idfirst 値を持つ a タグに accesskey 属性を追加する必要があります。

assert($('#first').attr('accesskey'));

コードは idsecond 値を持つ a タグに accesskey 属性を追加する必要があります。

assert($('#second').attr('accesskey'));

コードには idfirst 値を持つ a タグに accesskey 属性として g を設定する必要があります。 大文字・小文字が区別されることに注意してください。

assert($('#first').attr('accesskey') == 'g');

コードには idsecond 値を持つ a タグに accesskey 属性として c を設定する必要があります。 大文字・小文字が区別されることに注意してください。

assert($('#second').attr('accesskey') == 'c');

--seed--

--seed-contents--

<body>
  <header>
    <h1>Deep Thoughts with Master Camper Cat</h1>
  </header>
  <article>


    <h2><a id="first" href="#">The Garfield Files: Lasagna as Training Fuel?</a></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>
  <article>


    <h2><a id="second" href="#">Is Chuck Norris a Cat Person?</a></h2>


    <p>Chuck Norris is widely regarded as the premier martial artist on the planet, and it's a complete coincidence that anyone who disagrees with this fact mysteriously disappears soon after. But the real question is, is he a cat person?...</p>
  </article>
  <footer>&copy; 2018 Camper Cat</footer>
</body>

--solutions--

<body>
  <header>
    <h1>Deep Thoughts with Master Camper Cat</h1>
  </header>
  <article>


    <h2><a id="first" accesskey="g" href="#">The Garfield Files: Lasagna as Training Fuel?</a></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>
  <article>


    <h2><a id="second" accesskey="c" href="#">Is Chuck Norris a Cat Person?</a></h2>


    <p>Chuck Norris is widely regarded as the premier martial artist on the planet, and it's a complete coincidence that anyone who disagrees with this fact mysteriously disappears soon after. But the real question is, is he a cat person?...</p>
  </article>
  <footer>&copy; 2018 Camper Cat</footer>
</body>