GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — a11y: make the sidebar button a `<button>` by hugovk · Pull Request #14326 · sphinx-doc/sphinx

Conversation

@hugovk

@hugovk hugovk commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

Purpose

The sidebar button should be a semantic <button> and not a <div>.

This is needed for accessibility via keyboard and assistive technology.

For example, try this before and after this fix:

cd tests/roots/test-tocdepth
rm -rf _build
python -m sphinx -b html -D html_theme=classic -D html_theme_options.collapsiblesidebar=true . _build/html
open _build/html/index.html

Then press tab repeatedly.

Before, the <div> "button" can not be selected: _build-master.zip

After, the real <button> can be selected, and you can press space to open and close the side menu: _build-fixed.zip

References

  • https://theadminbar.com/accessibility-weekly/divs-are-not-buttons/
  • The element div#sidebar requires the attribute role="button" python/python-docs-theme#248

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

m-aciek reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@hugovk
a11y: make the sidebar button a <button>
4673397
@hugovk hugovk mentioned this pull request Feb 28, 2026
The element div#sidebar requires the attribute role="button" python/python-docs-theme#248
Open
@hugovk

hugovk commented Feb 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

The ty and 3.15 failures are unrelated and also occur in main master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gastmaier
gastmaier approved these changes Mar 4, 2026
View reviewed changes

@gastmaier gastmaier left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Welcome change, useful for both keyboard savvys and people with disabilities :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
timhoffm
timhoffm reviewed Mar 6, 2026
View reviewed changes

@timhoffm timhoffm left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This is fundamentally reasonable. However, it is a breaking change for downstream templates.

This will beak users who have styled the button with a div#sidebarbutton CSS filter, e.g. https://github.com/search?q=div%23sidebarbutton+language%3ACSS+NOT+is%3Afork&type=code

This needs a prominent change note and advice to change the style filter to #sidebarbutton.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

m-aciek reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@hugovk
Add to changelog
b80109e
@hugovk

hugovk commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

Added!

I put 9.2.0 as the version, but I don't mind if this needs a major bump. Some other semantic improvements have been done as bug fixes: #13689.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

timhoffm
timhoffm approved these changes Mar 6, 2026
View reviewed changes
themavik
themavik reviewed Mar 23, 2026
View reviewed changes

@themavik themavik left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nit: add type="button" on #sidebarbutton so it does not default to submit if this block ever sits inside a <form>.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hugovk reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
hugovk
hugovk commented Mar 23, 2026
View reviewed changes
Comment thread sphinx/themes/classic/layout.html Resolved

Uh oh!

There was an error while loading. Please reload this page.

@hugovk
Add type="button"
f087e3b
@jdillard jdillard added the accessibility label Jun 9, 2026
m-aciek
m-aciek approved these changes Sep 10, 2026
View reviewed changes
@hugovk
Merge branch 'master' into sidebar-button
c965d94
@hugovk

hugovk commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

CI failures are unrelated and are fixed by #14611, which is approved and awaiting merge.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner
AA-Turner force-pushed the master branch from da711b6 to 7cae411 Compare October 20, 2026 00:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@timhoffm timhoffm timhoffm approved these changes
+3 more reviewers
@themavik themavik themavik left review comments
@gastmaier gastmaier gastmaier approved these changes
@m-aciek m-aciek m-aciek approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

accessibility

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@hugovk @timhoffm @gastmaier @m-aciek @themavik @jdillard
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.