You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple accessibility widget that adds a skip link to the top of the page. The link is only visible when focused and allows users to jump directly to the main content.
3
+
Adds a skip navigation link for keyboard accessibility. The link is hidden until focused and allows users to jump directly to the main content.
4
4
5
5
## Usage
6
6
7
-
1. Place the `<SkipLink />` component at the very top of your page or layout.
8
-
2. Ensure your main content container has `id="main-content"`.
7
+
1. Add the Skip Link widget anywhere on your page, preferrably at the top or in a layout.
8
+
2. Configure the **Link Text** and **Main Content ID** properties.
9
+
3. Ensure your main content element has the specified ID, or there's a main tag on the page.
9
10
10
-
```jsx
11
-
<SkipLink />
12
-
<main id="main-content">Main content here</main>
13
-
```
11
+
The widget automatically inserts the skip link as the first child of the `#root` element.
14
12
15
-
## Accessibility
13
+
## Properties
16
14
17
-
- The skip link is visually hidden except when focused, making it accessible for keyboard and screen reader users.
15
+
-**Link Text**: Text displayed for the skip link (default: "Skip to main content").
16
+
-**Main Content ID**: ID of the main content element to focus (optional).
18
17
19
-
## End-to-End Testing
18
+
If the target element is not found, the widget will focus the first `<main>` element instead.
20
19
21
-
E2E tests are located in the `e2e/` folder and use Playwright. Run them with:
20
+
## Accessibility
22
21
23
-
```
24
-
npm install
25
-
npx playwright install
26
-
npm test
27
-
```
22
+
The skip link is positioned absolutely at the top-left of the page, hidden by default with `transform: translateY(-120%)`, and becomes visible when focused via keyboard navigation.
0 commit comments