Skip to content

Conversation

@ThanhNguyxn
Copy link
Contributor

@ThanhNguyxn ThanhNguyxn commented Jan 22, 2026

Summary

This PR adds a "Skip to main content" link for keyboard navigation in rustdoc, improving accessibility by allowing users to bypass the sidebar and navigate directly to the main content area.

Changes

  • src/librustdoc/html/templates/page.html: Added a skip link (<a class="skip-main-content">) immediately after the <body> tag that links to #main-content
  • src/librustdoc/html/static/css/rustdoc.css: Added CSS styles for the skip link:
    • Visually hidden by default (position: absolute; top: -100%)
    • Becomes visible when focused via Tab key (top: 0 on :focus)
    • Styled consistently with rustdoc theme using existing CSS variables
  • tests/rustdoc-gui/skip-navigation.goml: Added GUI test to verify the skip link functionality

WCAG Compliance

This addresses WCAG Success Criterion 2.4.1 (Level A) - Bypass Blocks:

A mechanism is available to bypass blocks of content that are repeated on multiple web pages.

Demo

When pressing Tab on a rustdoc page, the first focusable element is now the "Skip to main content" link, allowing keyboard users to jump directly to the main content without tabbing through the entire sidebar.

Future Improvements

Based on the discussion in #151420, additional skip links could be added between the page summary and module contents sections. This PR provides the foundation, and we can iterate on adding more skip links based on feedback.

Fixes #151420

r? @JayanAXHF

@rustbot
Copy link
Collaborator

rustbot commented Jan 22, 2026

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @lolbinarycat

Some changes occurred in GUI tests.

cc @GuillaumeGomez

@rustbot rustbot added A-rustdoc-js Area: Rustdoc's JS front-end S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jan 22, 2026
@rustbot

This comment has been minimized.

@JayanAXHF
Copy link
Member

Hey, thanks for the PR. I'll get a review in a day or two :)

@JayanAXHF JayanAXHF added the A-a11y Area: Anything to do with accessibility label Jan 22, 2026
@Kivooeo
Copy link
Member

Kivooeo commented Jan 22, 2026

Hello, thank you for this PR, but I have a question:

Why was the description generated using AI?

Secondly, in my understanding, it should be reviewed by @GuillaumeGomez (or other rustdoc member)

So...

r? GuillaumeGomez

@rustbot rustbot assigned GuillaumeGomez and unassigned JayanAXHF Jan 22, 2026
@Kivooeo
Copy link
Member

Kivooeo commented Jan 22, 2026

@JayanAXHF why was A-a11y label added here?

@JayanAXHF
Copy link
Member

@JayanAXHF why was A-a11y label added here?

Because the topic addresses an a11y concern. (Skip nav links are for a11y primarily)

@JayanAXHF
Copy link
Member

Why was the description generated using AI?

+1 to this question

Comment on lines 6 to 7
assert: ".skip-main-content"
assert-css: (".skip-main-content", {"position": "absolute"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only checks that its position is absolute, not that it's not visible.

assert-css: (".skip-main-content", {"position": "absolute"})

// The skip link should become visible when focused
focus: ".skip-main-content"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's supposed to be focused with the keyboard, wouldn't it make more sense to ensure the first tab selected item is this one instead?

assert-attribute: (".skip-main-content", {"href": "#main-content"})

// Verify main-content section exists
assert: "#main-content"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean... This item always exists. What should be checked is if it's focused.

// Pressing Enter on the skip link should navigate to main content
press-key: "Enter"
// After navigation, focus should be on or near main content
assert-document-property: ({"URL": "index.html#main-content"}, ENDS_WITH)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to also check that the element is focused.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not useful to check that the anchor is present in the URL, checking that the main-content element is focused is enough.

left: 0;
z-index: 1000;
padding: 0.5rem 1rem;
background-color: var(--main-background-color);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest an accented bg color

border: 1px solid var(--border-color);
border-radius: var(--button-border-radius);
text-decoration: none;
font-weight: 500;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Are these styles really necessary?

@ThanhNguyxn
Copy link
Contributor Author

Thank you all for the thorough review!

Regarding the AI-generated description question from @Kivooeo and @JayanAXHF:
I used GitHub Copilot to help structure the PR description format, but the implementation understanding and code are my own work. I appreciate the feedback and will be more mindful about this in future PRs.

Addressed all review feedback in the latest commit:

  1. @GuillaumeGomez's test feedback:

    • Test now presses Tab and verifies the skip link is the first focusable element
    • Removed unnecessary assert: ".skip-main-content" - now checking focus state instead
    • Added verification that focus moves to #main-content:focus after pressing Enter
    • Added tabindex="-1" to #main-content section to enable focus reception
  2. @JayanAXHF's CSS feedback:

    • Changed background to accent color (--search-input-focused-border-color) for better visibility
    • Removed unnecessary border, border-radius styles
    • Added outline-offset: 2px for cleaner focus indication

Please let me know if any further changes are needed!

assert-css: (".skip-main-content:focus", {"top": "0px"})

// The link should point to #main-content
assert-attribute: (".skip-main-content", {"href": "#main-content"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not useful to check btw.

Comment on lines 227 to 228
outline: 2px solid var(--main-color);
outline-offset: 2px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering this element is only visible when focused, I think we can move these two properties into .skip-main-content {} and only keep top: 0 in here.

outline-offset: 2px;
}
/* Hide focus outline on main-content when navigated via skip link */
#main-content:focus {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to just always have outline: none instead of only on :focus?

@ThanhNguyxn
Copy link
Contributor Author

Thanks for the detailed review @GuillaumeGomez!

Updated in latest commit:

  • Removed href attribute check and URL check from test
  • Moved outline properties to base .skip-main-content class, :focus now only sets top: 0
  • Changed #main-content:focus to #main-content for outline removal

Regarding tabindex="-1" on #main-content:

I kept this intentionally because it's required for the skip link to work correctly. Without it:

  • <section> is not focusable by default
  • When clicking the skip link, the browser scrolls to the target but doesn't move keyboard focus
  • The next Tab press would jump back to the top of the page instead of continuing from main content

This is a standard accessibility pattern for skip links (see WebAIM skip nav and MDN focus management).

Using tabindex="-1" means:

  • Element can receive programmatic focus (via skip link)
  • Element is NOT in the tab order (won't interfere with normal keyboard navigation)

Happy to discuss if you have concerns about this approach!

@ThanhNguyxn
Copy link
Contributor Author

@GuillaumeGomez Good point! Added the initial top: -100% check before focus to verify the property actually changes.

Test flow now:

  1. Check top: -100% (hidden)
  2. Press Tab → focus skip link
  3. Check top: 0px (visible)
  4. Press Enter → focus main-content

@GuillaumeGomez
Copy link
Member

Currently it looks like this:

image

Let me come up with something a little better.

top: 0;
}
#main-content {
outline: none;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this property into the existing #main-content {} below.

@ThanhNguyxn
Copy link
Contributor Author

@GuillaumeGomez Applied your suggestion - now checking |y_before| + |height_before| < 0 to ensure the element doesn't overlap with the viewport. 👍

@GuillaumeGomez
Copy link
Member

Seems all good to me, thanks!

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 23, 2026

📌 Commit 78afe87 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 23, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jan 23, 2026
…r=GuillaumeGomez

Add "Skip to main content" link for keyboard navigation in rustdoc

## Summary

This PR adds a "Skip to main content" link for keyboard navigation in rustdoc, improving accessibility by allowing users to bypass the sidebar and navigate directly to the main content area.

## Changes

- **`src/librustdoc/html/templates/page.html`**: Added a skip link (`<a class="skip-main-content">`) immediately after the `<body>` tag that links to `#main-content`
- **`src/librustdoc/html/static/css/rustdoc.css`**: Added CSS styles for the skip link:
  - Visually hidden by default (`position: absolute; top: -100%`)
  - Becomes visible when focused via Tab key (`top: 0` on `:focus`)
  - Styled consistently with rustdoc theme using existing CSS variables
- **`tests/rustdoc-gui/skip-navigation.goml`**: Added GUI test to verify the skip link functionality

## WCAG Compliance

This addresses **WCAG Success Criterion 2.4.1 (Level A)** - Bypass Blocks:
> A mechanism is available to bypass blocks of content that are repeated on multiple web pages.

## Demo

When pressing Tab on a rustdoc page, the first focusable element is now the "Skip to main content" link, allowing keyboard users to jump directly to the main content without tabbing through the entire sidebar.

## Future Improvements

Based on the discussion in rust-lang#151420, additional skip links could be added between the page summary and module contents sections. This PR provides the foundation, and we can iterate on adding more skip links based on feedback.

Fixes rust-lang#151420

r? @JayanAXHF
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jan 23, 2026
…r=GuillaumeGomez

Add "Skip to main content" link for keyboard navigation in rustdoc

## Summary

This PR adds a "Skip to main content" link for keyboard navigation in rustdoc, improving accessibility by allowing users to bypass the sidebar and navigate directly to the main content area.

## Changes

- **`src/librustdoc/html/templates/page.html`**: Added a skip link (`<a class="skip-main-content">`) immediately after the `<body>` tag that links to `#main-content`
- **`src/librustdoc/html/static/css/rustdoc.css`**: Added CSS styles for the skip link:
  - Visually hidden by default (`position: absolute; top: -100%`)
  - Becomes visible when focused via Tab key (`top: 0` on `:focus`)
  - Styled consistently with rustdoc theme using existing CSS variables
- **`tests/rustdoc-gui/skip-navigation.goml`**: Added GUI test to verify the skip link functionality

## WCAG Compliance

This addresses **WCAG Success Criterion 2.4.1 (Level A)** - Bypass Blocks:
> A mechanism is available to bypass blocks of content that are repeated on multiple web pages.

## Demo

When pressing Tab on a rustdoc page, the first focusable element is now the "Skip to main content" link, allowing keyboard users to jump directly to the main content without tabbing through the entire sidebar.

## Future Improvements

Based on the discussion in rust-lang#151420, additional skip links could be added between the page summary and module contents sections. This PR provides the foundation, and we can iterate on adding more skip links based on feedback.

Fixes rust-lang#151420

r? @JayanAXHF
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jan 23, 2026
…r=GuillaumeGomez

Add "Skip to main content" link for keyboard navigation in rustdoc

## Summary

This PR adds a "Skip to main content" link for keyboard navigation in rustdoc, improving accessibility by allowing users to bypass the sidebar and navigate directly to the main content area.

## Changes

- **`src/librustdoc/html/templates/page.html`**: Added a skip link (`<a class="skip-main-content">`) immediately after the `<body>` tag that links to `#main-content`
- **`src/librustdoc/html/static/css/rustdoc.css`**: Added CSS styles for the skip link:
  - Visually hidden by default (`position: absolute; top: -100%`)
  - Becomes visible when focused via Tab key (`top: 0` on `:focus`)
  - Styled consistently with rustdoc theme using existing CSS variables
- **`tests/rustdoc-gui/skip-navigation.goml`**: Added GUI test to verify the skip link functionality

## WCAG Compliance

This addresses **WCAG Success Criterion 2.4.1 (Level A)** - Bypass Blocks:
> A mechanism is available to bypass blocks of content that are repeated on multiple web pages.

## Demo

When pressing Tab on a rustdoc page, the first focusable element is now the "Skip to main content" link, allowing keyboard users to jump directly to the main content without tabbing through the entire sidebar.

## Future Improvements

Based on the discussion in rust-lang#151420, additional skip links could be added between the page summary and module contents sections. This PR provides the foundation, and we can iterate on adding more skip links based on feedback.

Fixes rust-lang#151420

r? @JayanAXHF
rust-bors bot pushed a commit that referenced this pull request Jan 23, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #149848 (Use allocator_shim_contents in allocator_shim_symbols)
 - #150556 (Add Tier 3 Thumb-mode targets for Armv7-A, Armv7-R and Armv8-R)
 - #151259 (Fix is_ascii performance regression on AVX-512 CPUs when compiling with -C target-cpu=native)
 - #151482 (Add "Skip to main content" link for keyboard navigation in rustdoc)
 - #151505 (Various refactors to the proc_macro bridge)
 - #151517 (Enable reproducible binary builds with debuginfo on Linux)
 - #151540 (Tweak bounds check in `DepNodeColorMap.get`)

r? @ghost
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 23, 2026
…r=GuillaumeGomez

Add "Skip to main content" link for keyboard navigation in rustdoc

## Summary

This PR adds a "Skip to main content" link for keyboard navigation in rustdoc, improving accessibility by allowing users to bypass the sidebar and navigate directly to the main content area.

## Changes

- **`src/librustdoc/html/templates/page.html`**: Added a skip link (`<a class="skip-main-content">`) immediately after the `<body>` tag that links to `#main-content`
- **`src/librustdoc/html/static/css/rustdoc.css`**: Added CSS styles for the skip link:
  - Visually hidden by default (`position: absolute; top: -100%`)
  - Becomes visible when focused via Tab key (`top: 0` on `:focus`)
  - Styled consistently with rustdoc theme using existing CSS variables
- **`tests/rustdoc-gui/skip-navigation.goml`**: Added GUI test to verify the skip link functionality

## WCAG Compliance

This addresses **WCAG Success Criterion 2.4.1 (Level A)** - Bypass Blocks:
> A mechanism is available to bypass blocks of content that are repeated on multiple web pages.

## Demo

When pressing Tab on a rustdoc page, the first focusable element is now the "Skip to main content" link, allowing keyboard users to jump directly to the main content without tabbing through the entire sidebar.

## Future Improvements

Based on the discussion in rust-lang#151420, additional skip links could be added between the page summary and module contents sections. This PR provides the foundation, and we can iterate on adding more skip links based on feedback.

Fixes rust-lang#151420

r? @JayanAXHF
rust-bors bot pushed a commit that referenced this pull request Jan 23, 2026
Rollup of 6 pull requests

Successful merges:

 - #149848 (Use allocator_shim_contents in allocator_shim_symbols)
 - #150556 (Add Tier 3 Thumb-mode targets for Armv7-A, Armv7-R and Armv8-R)
 - #151259 (Fix is_ascii performance regression on AVX-512 CPUs when compiling with -C target-cpu=native)
 - #151482 (Add "Skip to main content" link for keyboard navigation in rustdoc)
 - #151505 (Various refactors to the proc_macro bridge)
 - #151517 (Enable reproducible binary builds with debuginfo on Linux)

r? @ghost
jhpratt added a commit to jhpratt/rust that referenced this pull request Jan 24, 2026
…r=GuillaumeGomez

Add "Skip to main content" link for keyboard navigation in rustdoc

## Summary

This PR adds a "Skip to main content" link for keyboard navigation in rustdoc, improving accessibility by allowing users to bypass the sidebar and navigate directly to the main content area.

## Changes

- **`src/librustdoc/html/templates/page.html`**: Added a skip link (`<a class="skip-main-content">`) immediately after the `<body>` tag that links to `#main-content`
- **`src/librustdoc/html/static/css/rustdoc.css`**: Added CSS styles for the skip link:
  - Visually hidden by default (`position: absolute; top: -100%`)
  - Becomes visible when focused via Tab key (`top: 0` on `:focus`)
  - Styled consistently with rustdoc theme using existing CSS variables
- **`tests/rustdoc-gui/skip-navigation.goml`**: Added GUI test to verify the skip link functionality

## WCAG Compliance

This addresses **WCAG Success Criterion 2.4.1 (Level A)** - Bypass Blocks:
> A mechanism is available to bypass blocks of content that are repeated on multiple web pages.

## Demo

When pressing Tab on a rustdoc page, the first focusable element is now the "Skip to main content" link, allowing keyboard users to jump directly to the main content without tabbing through the entire sidebar.

## Future Improvements

Based on the discussion in rust-lang#151420, additional skip links could be added between the page summary and module contents sections. This PR provides the foundation, and we can iterate on adding more skip links based on feedback.

Fixes rust-lang#151420

r? @JayanAXHF
rust-bors bot pushed a commit that referenced this pull request Jan 24, 2026
Rollup of 8 pull requests

Successful merges:

 - #150556 (Add Tier 3 Thumb-mode targets for Armv7-A, Armv7-R and Armv8-R)
 - #151346 (add `simd_splat` intrinsic)
 - #151500 (hexagon: Add HVX target features)
 - #151505 (Various refactors to the proc_macro bridge)
 - #151517 (Enable reproducible binary builds with debuginfo on Linux)
 - #151482 (Add "Skip to main content" link for keyboard navigation in rustdoc)
 - #151489 (constify boolean methods)
 - #151551 (Don't use default build-script fingerprinting in `test`)

r? @ghost
jhpratt added a commit to jhpratt/rust that referenced this pull request Jan 24, 2026
…r=GuillaumeGomez

Add "Skip to main content" link for keyboard navigation in rustdoc

## Summary

This PR adds a "Skip to main content" link for keyboard navigation in rustdoc, improving accessibility by allowing users to bypass the sidebar and navigate directly to the main content area.

## Changes

- **`src/librustdoc/html/templates/page.html`**: Added a skip link (`<a class="skip-main-content">`) immediately after the `<body>` tag that links to `#main-content`
- **`src/librustdoc/html/static/css/rustdoc.css`**: Added CSS styles for the skip link:
  - Visually hidden by default (`position: absolute; top: -100%`)
  - Becomes visible when focused via Tab key (`top: 0` on `:focus`)
  - Styled consistently with rustdoc theme using existing CSS variables
- **`tests/rustdoc-gui/skip-navigation.goml`**: Added GUI test to verify the skip link functionality

## WCAG Compliance

This addresses **WCAG Success Criterion 2.4.1 (Level A)** - Bypass Blocks:
> A mechanism is available to bypass blocks of content that are repeated on multiple web pages.

## Demo

When pressing Tab on a rustdoc page, the first focusable element is now the "Skip to main content" link, allowing keyboard users to jump directly to the main content without tabbing through the entire sidebar.

## Future Improvements

Based on the discussion in rust-lang#151420, additional skip links could be added between the page summary and module contents sections. This PR provides the foundation, and we can iterate on adding more skip links based on feedback.

Fixes rust-lang#151420

r? @JayanAXHF
rust-bors bot pushed a commit that referenced this pull request Jan 24, 2026
Rollup of 8 pull requests

Successful merges:

 - #150556 (Add Tier 3 Thumb-mode targets for Armv7-A, Armv7-R and Armv8-R)
 - #151500 (hexagon: Add HVX target features)
 - #151505 (Various refactors to the proc_macro bridge)
 - #151517 (Enable reproducible binary builds with debuginfo on Linux)
 - #151482 (Add "Skip to main content" link for keyboard navigation in rustdoc)
 - #151489 (constify boolean methods)
 - #151551 (Don't use default build-script fingerprinting in `test`)
 - #151555 (Fix compilation of std/src/sys/pal/uefi/tests.rs)

r? @ghost
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jan 24, 2026
…r=GuillaumeGomez

Add "Skip to main content" link for keyboard navigation in rustdoc

## Summary

This PR adds a "Skip to main content" link for keyboard navigation in rustdoc, improving accessibility by allowing users to bypass the sidebar and navigate directly to the main content area.

## Changes

- **`src/librustdoc/html/templates/page.html`**: Added a skip link (`<a class="skip-main-content">`) immediately after the `<body>` tag that links to `#main-content`
- **`src/librustdoc/html/static/css/rustdoc.css`**: Added CSS styles for the skip link:
  - Visually hidden by default (`position: absolute; top: -100%`)
  - Becomes visible when focused via Tab key (`top: 0` on `:focus`)
  - Styled consistently with rustdoc theme using existing CSS variables
- **`tests/rustdoc-gui/skip-navigation.goml`**: Added GUI test to verify the skip link functionality

## WCAG Compliance

This addresses **WCAG Success Criterion 2.4.1 (Level A)** - Bypass Blocks:
> A mechanism is available to bypass blocks of content that are repeated on multiple web pages.

## Demo

When pressing Tab on a rustdoc page, the first focusable element is now the "Skip to main content" link, allowing keyboard users to jump directly to the main content without tabbing through the entire sidebar.

## Future Improvements

Based on the discussion in rust-lang#151420, additional skip links could be added between the page summary and module contents sections. This PR provides the foundation, and we can iterate on adding more skip links based on feedback.

Fixes rust-lang#151420

r? @JayanAXHF
rust-bors bot pushed a commit that referenced this pull request Jan 24, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #150556 (Add Tier 3 Thumb-mode targets for Armv7-A, Armv7-R and Armv8-R)
 - #151259 (Fix is_ascii performance regression on AVX-512 CPUs when compiling with -C target-cpu=native)
 - #151500 (hexagon: Add HVX target features)
 - #151517 (Enable reproducible binary builds with debuginfo on Linux)
 - #151482 (Add "Skip to main content" link for keyboard navigation in rustdoc)
 - #151489 (constify boolean methods)
 - #151551 (Don't use default build-script fingerprinting in `test`)
 - #151555 (Fix compilation of std/src/sys/pal/uefi/tests.rs)

r? @ghost
@rust-bors rust-bors bot merged commit ab06899 into rust-lang:main Jan 24, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Jan 24, 2026
rust-timer added a commit that referenced this pull request Jan 24, 2026
Rollup merge of #151482 - ThanhNguyxn:fix/rustdoc-skip-nav, r=GuillaumeGomez

Add "Skip to main content" link for keyboard navigation in rustdoc

## Summary

This PR adds a "Skip to main content" link for keyboard navigation in rustdoc, improving accessibility by allowing users to bypass the sidebar and navigate directly to the main content area.

## Changes

- **`src/librustdoc/html/templates/page.html`**: Added a skip link (`<a class="skip-main-content">`) immediately after the `<body>` tag that links to `#main-content`
- **`src/librustdoc/html/static/css/rustdoc.css`**: Added CSS styles for the skip link:
  - Visually hidden by default (`position: absolute; top: -100%`)
  - Becomes visible when focused via Tab key (`top: 0` on `:focus`)
  - Styled consistently with rustdoc theme using existing CSS variables
- **`tests/rustdoc-gui/skip-navigation.goml`**: Added GUI test to verify the skip link functionality

## WCAG Compliance

This addresses **WCAG Success Criterion 2.4.1 (Level A)** - Bypass Blocks:
> A mechanism is available to bypass blocks of content that are repeated on multiple web pages.

## Demo

When pressing Tab on a rustdoc page, the first focusable element is now the "Skip to main content" link, allowing keyboard users to jump directly to the main content without tabbing through the entire sidebar.

## Future Improvements

Based on the discussion in #151420, additional skip links could be added between the page summary and module contents sections. This PR provides the foundation, and we can iterate on adding more skip links based on feedback.

Fixes #151420

r? @JayanAXHF
JayanAXHF added a commit to JayanAXHF/rust that referenced this pull request Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-a11y Area: Anything to do with accessibility A-rustdoc-js Area: Rustdoc's JS front-end S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rustdoc doesn't have "Skip Navigation" links

6 participants