|
34 | 34 | <article aria-labelledby="hidden" class="space-y-4"> |
35 | 35 | <%= h2.("I want to hide an element", id: "hidden") %> |
36 | 36 |
|
37 | | - <p>You can hide using a large range of techniques. What you first want to ask is, from whom do I want to hide the content? |
| 37 | + <p>You can hide using a large range of techniques. What you first want to ask is, to whom do I want to show the content? |
38 | 38 |
|
39 | 39 | <%= list [ |
40 | | - "Hide from **everyone**.", |
41 | | - "**Screen reader affordance:** hide to sighted users, but show to screen reader users.", |
42 | | - "**Visual affordance:** hide to screen reader users, but show to sighted users." |
| 40 | + "Show to **everyone**. 👂✅ 👁✅", |
| 41 | + "Hide from **everyone**. 👂❌ 👁❌", |
| 42 | + "**Screen reader affordance:** show to screen reader users, hide to sighted users. 👂✅ 👁❌", |
| 43 | + "**Visual affordance:** show to sighted users, hide to screen reader users. 👂❌ 👁✅" |
43 | 44 | ] %> |
44 | 45 |
|
45 | 46 | <section aria-labelledby="hidden-all-heading"> |
46 | 47 | <%= h3.("Hidden to everyone", id: "hidden-all-heading") %> |
| 48 | + <p>To hide to everyone, add the <code>hidden</code> attribute.</p> |
47 | 49 | <%= h4.("Test") %> |
48 | 50 | <%= |
49 | 51 | """ |
|
69 | 71 | </section> |
70 | 72 |
|
71 | 73 | <section aria-labelledby="hidden-visually-heading"> |
72 | | - <%= h3.("Visually hidden (assistive technology affordance)", id: "hidden-visually-heading") %> |
| 74 | + <%#= h3.("Visually hidden (assistive technology only)", id: "hidden-visually-heading") %> |
| 75 | + <%= h3.("Assistive technology affordance (visually hidden)", id: "hidden-visually-heading") %> |
| 76 | + <p>To show to assistive technology but hide visually, add the <code>visually-hidden</code> class.</p> |
73 | 77 | <%= h4.("Test") %> |
74 | 78 | <%= |
75 | 79 | """ |
|
84 | 88 | <%= |
85 | 89 | """ |
86 | 90 | <a href="/profile"> |
87 | | - <span class="fas fa-user"></span> |
88 | | - <span visually-hidden>Profile</span> |
| 91 | + <span class="icon-user"></span> |
| 92 | + <span class="visually-hidden">Profile</span> |
89 | 93 | </a> |
90 | 94 | """ |> code_block(:html) |
91 | 95 | %> |
92 | 96 | <%= h4.("Styling") %> |
93 | 97 | <%= |
94 | 98 | """ |
95 | | - [visually-hidden] { |
| 99 | + .visually-hidden { |
96 | 100 | position: absolute; |
97 | 101 | overflow: hidden; |
98 | 102 | clip: rect(0 0 0 0); |
|
107 | 111 | </section> |
108 | 112 |
|
109 | 113 | <section aria-labelledby="hidden-screen-heading"> |
110 | | - <%= h3.("Visual affordance: hide to screen reader users", id: "hidden-screen-heading") %> |
| 114 | + <%= h3.("Visual affordance (hidden to assistive technology)", id: "hidden-screen-heading") %> |
| 115 | + <p>To show visually but hide to assistive technology, add the <code>aria-hidden</code> attribute.</p> |
111 | 116 | <%= h4.("Test") %> |
112 | 117 | <%= |
113 | 118 | """ |
114 | | - it("ignores emoji in accessible name", () => { |
| 119 | + it("does not include emoji in accessible name", () => { |
115 | 120 | expect( |
116 | 121 | screen.getByRole('link', { name: 'Profile' }) |
117 | 122 | ).toBeInTheDocument(); |
|
0 commit comments