diff --git a/files/en-us/learn/accessibility/wai-aria_basics/index.md b/files/en-us/learn/accessibility/wai-aria_basics/index.md index 57c7fb54fab30c8..c36bdc22e2024d0 100644 --- a/files/en-us/learn/accessibility/wai-aria_basics/index.md +++ b/files/en-us/learn/accessibility/wai-aria_basics/index.md @@ -123,29 +123,233 @@ See our section on [testing screen readers](/en-US/docs/Learn/Tools_and_testing/ ### Signposts/Landmarks -WAI-ARIA adds the [`role` attribute](https://www.w3.org/TR/wai-aria-1.1/#role_definitions) to browsers, which allows you to add extra semantic value to elements on your site wherever they are needed. The first major area in which this is useful is providing information for screen readers so that their users can find common page elements. Let's look at an example — our [website-no-roles](https://github.com/mdn/learning-area/tree/main/accessibility/aria/website-no-roles) example ([see it live](https://mdn.github.io/learning-area/accessibility/aria/website-no-roles/)) has the following structure: +WAI-ARIA adds the [`role` attribute](https://www.w3.org/TR/wai-aria-1.1/#role_definitions) to browsers, which allows you to add extra semantic value to elements on your site wherever they are needed. The first major area in which this is useful is providing information for screen readers so that their users can find common page elements. This example has the following structure: -```html +```html live-sample___aria-website-no-roles
-

+

Header

+ + +
+
-
- + +
+

Article heading

+ +

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Donec a diam + lectus. Set sit amet ipsum mauris. Maecenas congue ligula as quam viverra + nec consectetur ant hendrerit. Donec et mollis dolor. Praesent et diam + eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue + enim, ut porta lorem lacinia consectetur. +

+ +

subsection

+ +

+ Donec ut librero sed accu vehicula ultricies a non tortor. Lorem ipsum + dolor sit amet, consectetur adipisicing elit. Aenean ut gravida lorem. Ut + turpis felis, pulvinar a semper sed, adipiscing id dolor. +

+
+ + +
- + + + ``` +```css hidden live-sample___aria-website-no-roles +/* || General setup */ + +html, +body { + margin: 0; + padding: 0; +} + +html { + font-size: 10px; + background-color: #a9a9a9; +} + +body { + width: max(70vw, 90%); + margin: 0 auto; + padding: 0 10px; + display: flex; + flex-direction: column; +} + +/* || typography */ + +h1, +h2, +h3 { + font-family: "Sonsie One", cursive; + color: #2a2a2a; +} + +p, +input, +li { + font-family: "Open Sans Condensed", sans-serif; + color: #2a2a2a; +} + +h1 { + font-size: 4rem; + text-align: center; + color: white; + text-shadow: 2px 2px 10px black; +} + +h2 { + font-size: 3rem; + text-align: center; +} + +h3 { + font-size: 2.2rem; +} + +p, +li { + font-size: 1.6rem; + line-height: 1.5; +} + +/* || header layout */ + +header { + margin-bottom: 10px; +} + +nav, +article, +aside, +footer { + background-color: white; + padding: 1%; +} + +nav { + background-color: ff80ff; + display: flex; + gap: 2vw; + @media (width <= 650px) { + flex-direction: column; + } +} + +nav ul { + padding: 0; + list-style-type: none; + flex: 2; + display: flex; + gap: 2vw; +} + +nav li { + display: inline; + text-align: center; +} + +nav a { + display: inline-block; + font-size: 2rem; + text-transform: uppercase; + text-decoration: none; + color: black; +} + +nav form { + flex: 1; + display: flex; + align-items: center; + height: 100%; +} + +input { + font-size: 1.6rem; + height: 32px; +} + +input[type="search"] { + flex: 3; +} + +input[type="submit"] { + flex: 1; + margin-left: 1rem; + background: #333; + border: 0; + color: white; +} + +/* || main layout */ + +main { + display: flex; + gap: 2vw; + @media (width <= 650px) { + flex-direction: column; + } +} + +article { + flex: 4; +} + +aside { + flex: 1; + background-color: #ff80ff; +} + +aside li { + padding-bottom: 10px; +} + +footer { + margin-top: 10px; +} +``` + +{{EmbedLiveSample("aria-website-no-roles", "100", "850")}} + If you try testing the example with a screen reader in a modern browser, you'll already get some useful information. For example, VoiceOver gives you the following: - On the `
` element — "banner, 2 items" (it contains a heading and the `