Skip to content

Accessibility fixes: moderate violations#1338

Draft
jen-reeve wants to merge 3 commits into
mainfrom
audit-mod
Draft

Accessibility fixes: moderate violations#1338
jen-reeve wants to merge 3 commits into
mainfrom
audit-mod

Conversation

@jen-reeve

Copy link
Copy Markdown
Collaborator

No description provided.

@jen-reeve jen-reeve self-assigned this Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Test deployment successful!! (2026-07-17T04:18:14Z)
Preview available at https://callumwalley.github.io/mkdocs-demo-deploy/nesi/support-docs/audit-mod

See all deployed demo sites

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

Ahoy, ye scallywags! This patch attempts to fix accessibility and layout templates, but ye've managed to run the ship aground! Overridin' block container in main.html completely scuttles the main grid, sinkin' the sidebar and table of contents to Davy Jones' locker. Furthermore, yer fancy checkbox toggles and search icons lack proper keyboard focus, roles, and aria-expanded attributes, leavin' blind sailors completely lost in the dark. And why be torturin' the DOM with JS gymnastics to wrap a skip link when a simple template override would do? Cast that bloat overboard and patch these leaks before the whole vessel sinks!

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread overrides/main.html
Comment on lines +33 to 60
{% block container %}
<div class="md-content" data-md-component="content">
{% if "navigation.path" in features %}
{% include "partials/path.html" %}
{% endif %}
{% endif %}
{{ super() }}
<article class="md-content__inner md-typeset">
{% block content %}
{% if page.meta and page.meta.status %}
{% if page.meta.status == "deprecated" %}
{% include "partials/status_deprecated_header.html" %}
{% elif page.meta.status == "tutorial" %}
{% include "partials/status_tutorial_header.html" %}
{% endif %}
{% endif %}
{{ super() }}

{% if git_page_authors %}
<div class="md-source-date">
<small>
Authors: {{ git_page_authors | default('enable mkdocs-git-authors-plugin') }}
</small>
{% if git_page_authors %}
<div class="md-source-date">
<small>
Authors: {{ git_page_authors | default('enable mkdocs-git-authors-plugin') }}
</small>
</div>
{% endif %}
{% endblock %}
</article>
{% include "partials/source-file.html" %}
</div>
{% endif %}
{% endblock %}

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.

critical

Blimey! What sort of map are ye readin'? By overridin' block container and replacin' it with just the md-content div, ye've completely scuttled the ship's main grid! The sidebar navigation (site_nav) and the table of contents are gone to Davy Jones' locker!

Ye've already overridden partials/content.html to customize the inner content. There be absolutely no need to blow up the entire container. Revert this back to overridin' block content as it was before, or the whole layout will sink to the bottom of the sea!

{% block content %}
{% if page.meta and page.meta.status %}
    {% if page.meta.status == "deprecated" %}
        {% include "partials/status_deprecated_header.html" %}
    {% elif page.meta.status == "tutorial" %}
        {% include "partials/status_tutorial_header.html" %}
    {% endif %}
{% endif %}
{{ super() }}

{% if git_page_authors %}
<div class="md-source-date">
    <small>
        Authors: {{ git_page_authors | default('enable mkdocs-git-authors-plugin') }}
    </small>
</div>
{% endif %}
{% endblock %}

<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="{{ lang.t('search.placeholder') }}" placeholder="{{ lang.t('search.placeholder') }}" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<div class="md-search__icon md-icon" data-md-toggle-checkbox="__search">

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.

high

Avast! Ye've turned the search icon into a plain div with data-md-toggle-checkbox. But without role="button" and tabindex="0", no keyboard-navigating sailor can ever focus or trigger it to close the search on mobile! Give it the proper role and tabindex, ye scallywag!

      <div class="md-search__icon md-icon" data-md-toggle-checkbox="__search" role="button" tabindex="0" aria-label="{{ lang.t('search.reset') }}">

Comment on lines +99 to +105
const skipLink = document.querySelector('[data-md-component="skip"]');
if (skipLink) {
const nav = document.createElement("nav");
nav.setAttribute("aria-label", "Skip links");
skipLink.replaceWith(nav);
nav.appendChild(skipLink);
}

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.

medium

Shiver me timbers! Why be torturin' the DOM with JS gymnastics just to wrap a skip link? Ye've already overridden half the templates in the repository! Ye can simply create an override for partials/skip.html and wrap the skip link in a <nav> landmark there. This JS hack forces a hardcoded English string 'Skip links' upon us, violating the code of internationalization (i18n). Cast this JS bloat overboard!

Suggested change
const skipLink = document.querySelector('[data-md-component="skip"]');
if (skipLink) {
const nav = document.createElement("nav");
nav.setAttribute("aria-label", "Skip links");
skipLink.replaceWith(nav);
nav.appendChild(skipLink);
}
// Skip link wrapping moved to overrides/partials/skip.html

Comment on lines +133 to +136
<div class="md-nav__title" role="button" tabindex="0" data-md-toggle-checkbox="{{ path }}">
<span class="md-nav__icon md-icon"></span>
{{ render_title(nav_item) }}
</div>

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.

medium

Aha! Ye've turned the label into a role="button", but ye forgot to tell the blind sailors whether the hatch is open or shut! A button that toggles a section needs aria-expanded to let screen readers know its state. Add aria-expanded to the template so they don't go sailin' into the dark!

            <div class="md-nav__title" role="button" tabindex="0" data-md-toggle-checkbox="{{ path }}" aria-expanded="{{ 'true' if nav_item.active else 'false' }}">
              <span class="md-nav__icon md-icon"></span>
              {{ render_title(nav_item) }}
            </div>

Comment on lines +113 to +119
function toggleCheckboxTarget(target) {
const checkbox = document.getElementById(target.getAttribute("data-md-toggle-checkbox"));
if (checkbox) {
checkbox.checked = !checkbox.checked;
checkbox.dispatchEvent(new Event("change", { bubbles: true }));
}
}

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.

medium

If ye be changin' the checkbox state in JS, ye must also update the aria-expanded attribute on the button itself, or the screen readers will be left clueless! Update the attribute when togglin' the checkbox.

function toggleCheckboxTarget(target) {
    const checkbox = document.getElementById(target.getAttribute("data-md-toggle-checkbox"));
    if (checkbox) {
        checkbox.checked = !checkbox.checked;
        checkbox.dispatchEvent(new Event("change", { bubbles: true }));
        if (target.getAttribute("role") === "button") {
            target.setAttribute("aria-expanded", checkbox.checked ? "true" : "false");
        }
    }
}

@github-actions

Copy link
Copy Markdown
Contributor

AccessLint audit — https://callumwalley.github.io/mkdocs-demo-deploy/nesi/support-docs/audit-mod/

No violations at the configured threshold (1 below threshold filtered).
Generated 2026-07-17T04:19:42.049Z · run log · AccessLint/audit

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant