Skip to content

Commit 6edc00d

Browse files
authored
Add landmarks
1 parent c3af80f commit 6edc00d

File tree

4 files changed

+40
-8
lines changed

4 files changed

+40
-8
lines changed

apps/components_guide_web/lib/components_guide_web/controllers/accessibility_first_controller.ex

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ defmodule ComponentsGuideWeb.AccessibilityFirstController do
66
render(conn, "index.html", article: "intro")
77
end
88

9-
def show(conn, %{"id" => "landmarks"}) do
10-
render(conn, "landmarks.html")
11-
end
12-
139
def show(conn, %{"id" => "widgets-cheatsheet"}) do
1410
render(conn, "widgets-cheatsheet.html")
1511
end
@@ -18,7 +14,7 @@ defmodule ComponentsGuideWeb.AccessibilityFirstController do
1814
render(conn, "properties-cheatsheet.html")
1915
end
2016

21-
@articles ["navigation", "roles", "accessible-name", "forms", "content"]
17+
@articles ["navigation", "landmarks", "roles", "accessible-name", "forms", "content"]
2218

2319
def show(conn, %{"id" => article}) when article in @articles do
2420
render(conn, "index.html", article: article)

apps/components_guide_web/lib/components_guide_web/templates/accessibility_first/_nav.html.eex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<ul y-y x-x=md class="text-lg font-bold text-shadow" style="--link-padding: 0.75em">
33
<li><%= link("Why?", to: '/accessibility-first') %>
44
<li><%= link("Navigation", to: '/accessibility-first/navigation') %>
5+
<li><%= link("Landmarks", to: '/accessibility-first/landmarks') %>
56
<li><%= link("Content", to: '/accessibility-first/content') %>
67
<li><%= link("Forms", to: '/accessibility-first/forms') %>
78
<li><%= link("All Roles", to: '/accessibility-first/roles') %>

apps/components_guide_web/lib/components_guide_web/templates/accessibility_first/intro.html.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ HTML is not an after-thought, it’s not a ‘solved problem’, it’s not some
1414

1515
1. **Links vs Buttons:** use links for navigating and buttons for actions.
1616
1. **Landmarks:** provide familiar touch points that users can jump to.
17-
2. **Semantics & Roles:** give every element semantic meaning.
18-
3. **Widgets:** allow everyone to use your controls.
19-
4. **Properties:** hide or mark elements using accessibility attributes.
17+
2. **Semantic Content:** add meaningful structure to your content.
18+
3. **Usable Forms:** ensure form controls are labelled and have the correct roles.
19+
4. **Widgets:** allow everyone to use your controls.
20+
5. **Properties:** hide or mark elements using accessibility attributes.
21+
22+
```ts
23+
getByRole('link', { name: 'About' });
24+
25+
getByRole('button', { name: 'Sign up to newsletter' });
26+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Landmarks
2+
3+
When you visit a new city, one thing you expect to see are landmarks. Statues, botanical gardens, theaters, skyscrapers, markets. These landmarks help us navigate around unfamiliar areas by being reference points we can see on the horizon or on a map.
4+
5+
As makers of the web, we can also provide landmarks to people. These aren’t arbitrary — there are eight landmarks that are part of the HTML standard:
6+
7+
- Navigation
8+
- Main
9+
- Banner
10+
- Search
11+
- Form
12+
- Content info
13+
- Region
14+
- Complementary
15+
16+
Some of these seem obvious, but some are odd — what on earth does “contentinfo” mean? Let’s walk through what they are, why they are important to provide, and finally how we can really easily use them.
17+
18+
## Navigation
19+
20+
Nearly all websites have a primary navigation. It’s often presented as a row of links at the top of the page, or under a hamburger menu.
21+
22+
![Stripe’s navigation bar at the top of its homepage][stripe-nav]
23+
24+
Stripe’s navigation provides links to the primary pages people want to visit. It’s clear, and follows common practices of showing only a handful of links, and placing the link to sign in up on the far right.
25+
26+
Most visual users would identify this as the primary navigation of the site, and so you should denote it as such in your HTML markup. Here’s what you might write for Stripe’s navigation:
27+
28+
[stripe-nav]: https://icing.space/wp-content/uploads/2020/03/DraggedImage.77e7cbde60df4e08a4eac02d9ce73454-2048x134.png

0 commit comments

Comments
 (0)