Skip to content

feat: Add a Chapter on Accessibility in the Rustdoc book#151106

Open
JayanAXHF wants to merge 9 commits intorust-lang:mainfrom
JayanAXHF:rustdoc_accessibility
Open

feat: Add a Chapter on Accessibility in the Rustdoc book#151106
JayanAXHF wants to merge 9 commits intorust-lang:mainfrom
JayanAXHF:rustdoc_accessibility

Conversation

@JayanAXHF
Copy link
Copy Markdown
Member

@JayanAXHF JayanAXHF commented Jan 14, 2026

This PR adds a chapter on the accessibility of rustdoc, the accessible practices followed by rustdoc, WCAG 2.1 compliance, and known issues with rustdoc w.r.t. accessibility. Please see #151007 for more information.

Zulip Discussion: #t-rustdoc > A Proposal to Make Rustdoc More Accessible

cc: @GuillaumeGomez

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 14, 2026
@JayanAXHF JayanAXHF force-pushed the rustdoc_accessibility branch from 8ded36a to 07d2971 Compare January 20, 2026 18:26
@JayanAXHF JayanAXHF marked this pull request as ready for review January 25, 2026 12:49
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 25, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 25, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jan 25, 2026

r? @notriddle

rustbot has assigned @notriddle.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot

This comment has been minimized.

@JayanAXHF
Copy link
Copy Markdown
Member Author

@GuillaumeGomez The chapter is (imo) complete and ready for review!

@JayanAXHF
Copy link
Copy Markdown
Member Author

@rustbot r? GuillaumeGomez

@rustbot rustbot assigned GuillaumeGomez and unassigned notriddle Jan 25, 2026
@JayanAXHF JayanAXHF added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-a11y Area: Anything to do with accessibility labels Jan 25, 2026
Co-authored-by: Michael Howell <michael@notriddle.com>
@JayanAXHF
Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 1, 2026

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

1. `rustdoc` only uses JavaScript to make your experience better, but `rustdoc` works perfectly well without it, meaning that most interactive features should work well without JavaScript. This ensures that no hidden scripts or interactive elements mess with screen readers and other accessibility tools.
2. `rustdoc` uses semantic HTML elements wherever possible.
1. We use `<details>` instead of checkboxes so text can still be searched in hidden and collapsed content.
2. We use the `title` attribute to make your experience better, but `rustdoc` is perfectly usable without them. The **`title`** global attribute contains text representing advisory information related to the element it belongs to.[^4]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
2. We use the `title` attribute to make your experience better, but `rustdoc` is perfectly usable without them. The **`title`** global attribute contains text representing advisory information related to the element it belongs to.[^4]
2. We use the `title` attribute on HTML elements. The **`title`** attribute contains text representing advisory information related to the element it belongs to.[^4]

Also it's the only attribute/tag you explain.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah I need to expand on this a bit more, haven't gotten enough time though rn due to exams and all

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't the whole point of this note to elaborate that title should never be used for vital functionality?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah iirc that's why it's there. I should make that clearer

1. We use `<details>` instead of checkboxes so text can still be searched in hidden and collapsed content.
2. We use the `title` attribute to make your experience better, but `rustdoc` is perfectly usable without them. The **`title`** global attribute contains text representing advisory information related to the element it belongs to.[^4]
3. All necessary elements are annotated by aria labels, to ensure that all elements have an accessible name[^4] for screen reader compatibility.
4. `rustdoc` has expansive support for keyboard navigation, such as keybinds for searching, focusing and interacting with the UI.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see how it's related to accessibility.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The first point? Well some screenreaders have trouble with collapsible sections, and the recommended way to have collapsibles is using the semantic tags. Some sites just use js and random tags for that, so I though it'd be worth mentioning

Copy link
Copy Markdown
Member

@GuillaumeGomez GuillaumeGomez left a comment

Choose a reason for hiding this comment

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

Little things to change

View changes since this review

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 7, 2026
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
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-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants