|
Improved accessibility for docs console tabs within constraints of the
current CSS-only, hidden radio button implementation.
* Switched to flex layout. (Previous `text-align: right` could cause
problems in rtl scripts.)
* Changed radio buttons from `display: none` to visually hidden. This
allows them to participate in keyboard navigation (with or without
a screen reader).
* Rendered a focus outline on the visible label when the hidden radio
button has focus.
* Increased border widths on the active tab to allow distinguishing it
with high contrast settings (forced-colors: active).
* Increased contrast on inactive tab label and active tab border.
* Created `--tab-*` CSS properties in `.console-block` to allow adapting
to other themes or contexts (e.g., on docs.djangoproject.com).
Screen readers will announce console tabs as radio buttons. (JavaScript
would be needed to properly implement the WAI-ARIA tab pattern with the
expected behavior for tab-group, tab, and tab-panel ARIA roles.)
Thanks to Natalia Bidart (nessita), Tom Carrick, and Akintola Rahmat for
their reviews and suggestions.
|
|
* Removed unnecessary `table` and `parameterlist` customizations from
the djangodocs Sphinx extension's `DjangoHTMLTranslator`. These were
meant to avoid obsolete html from Docutils' html4 writer (`border=1`
in `<table>` tags and and `<big>` around parameter list parens).
Sphinx 2.0 switched to the html5 writer, which doesn't emit that html.
These overrides are no longer necessary, rely on Sphinx internals that
often break in new versions, and interfere with third-party themes.
* Moved the console-tabs.css stylesheet to docs/_static and removed
logic for conditionally including it only in pages with console tabs.
That depended on custom handling in the djangodocs theme layout.html
template, which isn't portable to other themes.
* Switched console tabs from Font Awesome brand icons to text and
removed the vendored fa-brands fonts (to avoid moving them from the
djangodocs theme to the docs/_static dir).
* Ensured both console tabs include a wrapper div around literal code
blocks: `<div class="highlight-{lexer} notranslate">` (where lexer is
`console` for Unix and `doscon` for Windows). This wrapper had been
missing for the Windows content, which could cause shifting layouts
when changing tabs with third-party Sphinx themes (and may have
interfered with browser translation tools).
Fixed by rendering the Windows tab with a temporary literal block,
matching how the Unix tab is rendered. Removed direct call to the
Pygments highlighter.
The Windows tab is no longer force-highlighted, so a doscon lexing
failure now reports a warning rather than being silently ignored.
* Removed custom `VersionDirective` and HTML writer overrides for
`visit_versionmodified()` and `depart_versionmodified()`. Sphinx's
standard changeset directives are now used. (Refs #20104.)
The original code was meant to substitute "development version" for
conf.py `django_next_version` and to refer to "Django N.M" rather than
the generic "version N.M" in changeset messages. But it missed the
`deprecated` directive and aliases like `version-modified` added in
Sphinx 9.0, didn't apply to non-HTML output formats, and generated
inconsistent HTML that wasn't compatible with standard Sphinx themes.
Related cleanup:
* Updated documentation on using versionadded and versionchanged
directives to accurately reflect Sphinx's rendered text, and removed
the policy bullet describing the old Django-specific phrasing.
* Enabled biome for all css and js files in docs (except in
docs/_build).
* Consistently excluded all non-docs source dirs and requirements.txt
from searches for *.txt source files in conf.py exclude_patterns,
make.bat, Makefile, and lint.py.
Refs #35874, #37138, #20104.
|