* refactor(a11y): comprehensive WCAG 2.2 AA accessibility improvements
Add skip-to-content link, landmark regions, ARIA attributes, keyboard
navigation, focus styles, reduced-motion support, and i18n keys across
all layouts, partials, shortcodes, and JS components.
- Add skip nav link in baseof.html and id="content" on all <main> tags
- Fix 404 page lang/dir attributes and add <main> landmark
- Add aria-label to banner close, PDF iframe, search input/results
- Remove aria-hidden from back-to-top button
- Add aria-hidden to decorative external link icon
- Add role="tablist" to tabs, aria-expanded to filetree/dropdowns
- Wrap mermaid diagrams in role="img", asciinema in role="region"
- Change theme toggle <p> items to <button role="menuitem"> with
full keyboard navigation (Arrow/Home/End/Escape)
- Add arrow-key keyboard navigation to tabs component
- Separate sidebar collapsible button from link for independent
keyboard access with aria-expanded sync
- Sync aria-expanded on all dropdown toggles (theme, lang, navbar,
hamburger, page context menu)
- Add aria-live search status announcements
- Add 13 new i18n keys, replace hardcoded aria-label strings
- Add prefers-reduced-motion CSS override and focus-visible base styles
- Add aria-label swap on code copy ("Copied!" feedback for AT)
- Add aria-current to active TOC links
- Wrap filetree in <ul> container for proper list semantics
- Add unique aria-label to blog "Read more" links
- Document accessibility guidelines in AGENTS.md
* feat(a11y): enhance focus styles and accessibility for various components
- Add focus-visible styles to badges, buttons, and links for improved keyboard navigation.
- Update breadcrumb, sidebar, and TOC components to include focus-visible outlines.
- Introduce new classes for focus states in the badge and tabs shortcodes.
- Ensure consistent focus styles across all interactive elements to meet WCAG 2.2 AA standards.
* feat(a11y): implement new focus-visible utilities and enhance accessibility styles
- Introduce new utility classes for focus-visible states to improve keyboard navigation.
- Update various components including badges, buttons, and search inputs to utilize new focus-visible styles.
- Refactor existing focus styles to ensure consistency and compliance with accessibility standards.
- Enhance breadcrumb, sidebar, and TOC components with updated focus-visible classes for better user experience.
* chore: add .gitattributes to collapse generated files in PR diffs
* fix: enhance accessibility and improve documentation
- Added alt attributes to images in multiple language documentation files for better accessibility.
- Updated the navbar title partial to remove unnecessary title attribute.
- Improved search input accessibility by adding autocomplete="off".
- Enhanced search partials in both navbar and sidebar with location context.
- Updated SVG icons in various components to include aria-hidden and focusable attributes for improved accessibility compliance.
* fix: improve giscus theme toggle functionality
- Updated the theme toggle options selector to use a data attribute for better specificity.
- Modified the event listener to use a setTimeout for the theme update, ensuring smoother transitions when the theme switcher is clicked.
* fix: resolve axe-core WCAG AA violations across docs pages
Add aria-labels to Hugo task list checkboxes, fix asciinema player
timer accessible names, make Jupyter output cells keyboard-focusable,
and add missing heading hierarchy in shortcodes docs for fa/ja/zh-cn.
* feat: integrate accessibility testing with Playwright and enhance CI workflow
- Added Playwright configuration for accessibility testing.
- Implemented accessibility tests using axe-core for all English pages.
- Created a GitHub Actions workflow to automate accessibility tests on pull requests.
- Updated package dependencies to include @axe-core/playwright and @playwright/test.
- Enhanced sidebar component with data attributes for improved accessibility styling.
* fix: update base URL and improve accessibility labels across multiple languages
- Changed the base URL in Playwright configuration and CI workflow from localhost:3000 to localhost:1313.
- Added accessibility labels for screen readers in various language files, enhancing user experience for visually impaired users.
- Updated the Asciinema script to dynamically set the playback time label for better accessibility compliance.
* refactor: reorganize accessibility tests and update test directory structure
- Moved accessibility tests from the e2e directory to a new tests directory for better organization.
- Updated the test directory path in Playwright configuration.
- Refactored the accessibility test implementation to improve code clarity and maintainability.
* chore: update .gitignore to include Playwright test output directories
- Added entries for 'playwright-report/' and 'test-results/' to the .gitignore file to prevent cluttering the repository with test artifacts.
* refactor: enhance accessibility and improve focus styles across components
- Removed unused utility for focus visibility in CSS and consolidated focus-visible styles for better maintainability.
- Updated various components to use `role` attributes for improved accessibility, including menu items and buttons.
- Enhanced theme toggle and language switch components with appropriate ARIA roles and attributes for better screen reader support.
- Improved the handling of focus states in the navigation and context menus to ensure a consistent user experience.
* chore: update dependencies and enhance accessibility features
- Updated the 'serve' package version in package.json and package-lock.json for improved performance.
- Removed unused 'xml2js' dependency to streamline the project.
- Enhanced the Playwright configuration to better manage the web server setup for testing.
- Improved accessibility in the language switcher and navigation menu by refining focus management and keyboard interactions.
- Updated the back-to-top button to manage tabindex for better accessibility compliance.
* feat: enhance mobile menu accessibility and keyboard interactions
- Added ARIA attributes to manage visibility of the sidebar on mobile devices.
- Implemented focus management for the sidebar when the menu is toggled.
- Introduced keyboard support to close the menu with the Escape key.
- Improved overall accessibility for the hamburger menu and sidebar interactions.
* fix: refine mobile menu keyboard interaction and enhance navbar accessibility
- Updated the Escape key functionality to close the menu only on mobile devices.
- Added a new ARIA attribute to the hamburger menu button for improved accessibility.
91 lines
5.6 KiB
HTML
91 lines
5.6 KiB
HTML
{{- $enableGlobal := site.Params.page.contextMenu.enable | default false -}}
|
|
{{- $enablePage := .Params.contextMenu -}}
|
|
{{- $enable := cond (ne $enablePage nil) $enablePage $enableGlobal -}}
|
|
{{- $customLinks := site.Params.page.contextMenu.links | default slice -}}
|
|
|
|
{{- if $enable -}}
|
|
{{- with .OutputFormats.Get "markdown" -}}
|
|
{{- $markdownURL := .Permalink -}}
|
|
{{- $pageURL := $.Permalink -}}
|
|
{{- $pageTitle := $.Title -}}
|
|
<div class="hextra-page-context-menu hx:relative hx:inline-flex hx:shrink-0">
|
|
<div class="hx:inline-flex hx:rounded-lg hx:border hx:border-gray-200 hx:transition-colors hx:hover:border-gray-300 hx:dark:border-neutral-800 hx:dark:hover:border-neutral-700">
|
|
<button
|
|
class="hextra-page-context-menu-copy hx:group/copybtn hx:inline-flex hx:cursor-pointer hx:items-center hx:gap-1.5 hx:bg-transparent hx:px-2.5 hx:py-1 hx:text-sm hx:font-medium hx:text-gray-700 hx:transition-colors hx:hover:bg-slate-50 hx:dark:text-gray-300 hx:dark:hover:bg-neutral-900 hx:ltr:rounded-l-lg hx:rtl:rounded-r-lg hx:hextra-focus-visible-inset"
|
|
data-url="{{ $markdownURL }}"
|
|
title="{{ i18n "copyAsMarkdown" }}"
|
|
aria-label="{{ i18n "copyAsMarkdown" }}"
|
|
>
|
|
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:size-4">
|
|
{{- partial "utils/icon.html" (dict "name" "copy" "attributes" "height=16 width=16") -}}
|
|
</div>
|
|
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:size-4">
|
|
{{- partial "utils/icon.html" (dict "name" "check" "attributes" "height=16 width=16") -}}
|
|
</div>
|
|
<span>{{ i18n "copyPage" }}</span>
|
|
</button>
|
|
<button
|
|
class="hextra-page-context-menu-toggle hx:inline-flex hx:cursor-pointer hx:items-center hx:justify-center hx:bg-transparent hx:px-1.5 hx:py-1 hx:text-gray-500 hx:transition-colors hx:hover:bg-slate-50 hx:hover:text-gray-700 hx:dark:text-gray-400 hx:dark:hover:bg-neutral-900 hx:dark:hover:text-gray-300 hx:ltr:rounded-r-lg hx:rtl:rounded-l-lg hx:hextra-focus-visible-inset"
|
|
data-state="closed"
|
|
aria-label="{{ (T "togglePageContextMenu") | default "Toggle page context menu" }}"
|
|
aria-expanded="false"
|
|
aria-haspopup="menu"
|
|
>
|
|
<div class="hx:size-4 hx:transition-transform hx:duration-200" data-chevron>
|
|
{{- partial "utils/icon.html" (dict "name" "chevron-down" "attributes" "height=16 width=16") -}}
|
|
</div>
|
|
</button>
|
|
</div>
|
|
<ul class="hextra-page-context-menu-dropdown not-prose hx:hidden hx:absolute hx:top-full hx:left-0 hx:sm:left-auto hx:sm:right-0 hx:mt-1 hx:z-20 hx:max-h-64 hx:overflow-auto hx:rounded-lg hx:border hx:border-gray-200 hx:bg-white hx:p-1 hx:text-sm hx:shadow-lg hx:dark:border-neutral-700 hx:dark:bg-neutral-900" role="menu">
|
|
<li role="none">
|
|
<button
|
|
data-action="copy"
|
|
role="menuitem"
|
|
class="hx:flex hx:w-full hx:cursor-pointer hx:select-none hx:items-center hx:gap-2 hx:whitespace-nowrap hx:rounded-sm hx:px-2 hx:py-1.5 hx:text-sm hx:text-gray-700 hx:outline-none hx:transition-colors hx:hover:bg-gray-100 hx:hover:text-gray-900 hx:dark:text-gray-300 hx:dark:hover:bg-neutral-800 hx:dark:hover:text-gray-100"
|
|
>
|
|
<div class="hx:size-4 hx:shrink-0 hx:text-gray-500 hx:dark:text-gray-400">
|
|
{{- partial "utils/icon.html" (dict "name" "copy" "attributes" "height=16 width=16") -}}
|
|
</div>
|
|
{{ i18n "copyAsMarkdown" }}
|
|
</button>
|
|
</li>
|
|
<li role="none">
|
|
<button
|
|
data-action="view"
|
|
data-url="{{ $markdownURL }}"
|
|
role="menuitem"
|
|
class="hx:flex hx:w-full hx:cursor-pointer hx:select-none hx:items-center hx:gap-2 hx:whitespace-nowrap hx:rounded-sm hx:px-2 hx:py-1.5 hx:text-sm hx:text-gray-700 hx:outline-none hx:transition-colors hx:hover:bg-gray-100 hx:hover:text-gray-900 hx:dark:text-gray-300 hx:dark:hover:bg-neutral-800 hx:dark:hover:text-gray-100"
|
|
>
|
|
<div class="hx:size-4 hx:shrink-0 hx:text-gray-500 hx:dark:text-gray-400">
|
|
{{- partial "utils/icon.html" (dict "name" "markdown" "attributes" "height=16 width=16") -}}
|
|
</div>
|
|
{{ i18n "viewAsMarkdown" }}
|
|
</button>
|
|
</li>
|
|
{{- if $customLinks -}}
|
|
<li class="hx:my-1 hx:h-px hx:bg-gray-200 hx:dark:bg-neutral-700" role="separator"></li>
|
|
{{- range $customLinks -}}
|
|
{{- $linkURL := partial "utils/template-url.html" (dict "template" .url "values" (dict "url" $pageURL "title" $pageTitle "markdown_url" $markdownURL)) -}}
|
|
<li role="none">
|
|
<a
|
|
href="{{ $linkURL }}"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
role="menuitem"
|
|
class="hx:flex hx:w-full hx:cursor-pointer hx:select-none hx:items-center hx:gap-2 hx:whitespace-nowrap hx:rounded-sm hx:px-2 hx:py-1.5 hx:text-sm hx:text-gray-700 hx:outline-none hx:transition-colors hx:hover:bg-gray-100 hx:hover:text-gray-900 hx:dark:text-gray-300 hx:dark:hover:bg-neutral-800 hx:dark:hover:text-gray-100"
|
|
>
|
|
{{- with .icon -}}
|
|
<div class="hx:size-4 hx:shrink-0 hx:text-gray-500 hx:dark:text-gray-400">
|
|
{{- partial "utils/icon.html" (dict "name" . "attributes" "height=16 width=16") -}}
|
|
</div>
|
|
{{- end -}}
|
|
{{ .name }}
|
|
</a>
|
|
</li>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
</ul>
|
|
</div>
|
|
{{- end -}}
|
|
{{- end -}}
|