Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/checkbox-accessibility-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@radui/ui": patch
---

Add Checkbox keyboard interaction and ARIA reference tables to the docs.
6 changes: 5 additions & 1 deletion docs/app/docs/components/checkbox/content.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Documentation from '@/components/layout/Documentation/Documentation';
import CheckboxExample from "./docs/example_1"
import { code, anatomy, api_documentation } from "./docs/codeUsage"
import { code, anatomy, ariaReferences, keyboardShortcuts, api_documentation } from "./docs/codeUsage"

<Documentation
title="Checkbox"
Expand All @@ -15,4 +15,8 @@ import { code, anatomy, api_documentation } from "./docs/codeUsage"
tables={api_documentation}
order={['root', 'indicator']}
/>

<Documentation.Table title="Keyboard Interactions" columns={keyboardShortcuts.columns} data={keyboardShortcuts.data} />

<Documentation.Table title="ARIA References" columns={ariaReferences.columns} data={ariaReferences.data} />
</Documentation>
28 changes: 28 additions & 0 deletions docs/app/docs/components/checkbox/docs/codeUsage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { getSourceCodeFromPath } from '@/utils/parseSourceCode';
import root_api from './component_api/root.tsx';
import indicator_api from './component_api/indicator.tsx';
import {
createAriaReferenceRow,
createAriaReferenceTable,
DOCS_ARIA_PATTERNS
} from '../../shared/ariaReferences';
import {
createKeyboardShortcutRow,
createKeyboardShortcutTable,
DOCS_KEYBOARD_SHORTCUTS
} from '../../shared/keyboardShortcuts';

const example_1_SourceCode = await getSourceCodeFromPath('docs/app/docs/components/checkbox/docs/example_1.tsx');
const scss_SourceCode = await getSourceCodeFromPath('styles/themes/components/checkbox.scss');
Expand All @@ -18,4 +28,22 @@ export const api_documentation = {
indicator: indicator_api
};

export const keyboardShortcuts = createKeyboardShortcutTable([
createKeyboardShortcutRow(
DOCS_KEYBOARD_SHORTCUTS.TAB,
'Moves focus to the checkbox.'
),
createKeyboardShortcutRow(
DOCS_KEYBOARD_SHORTCUTS.SPACE,
'Toggles between checked and unchecked states.'
)
]);

export const ariaReferences = createAriaReferenceTable([
createAriaReferenceRow(
DOCS_ARIA_PATTERNS.CHECKBOX,
'Uses checkbox semantics with aria-checked to expose checked, unchecked, or mixed state.'
)
]);

export default code;
5 changes: 5 additions & 0 deletions docs/app/docs/components/shared/ariaReferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export const DOCS_ARIA_PATTERNS = Object.freeze({
label: 'Alert dialog pattern',
href: 'https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/'
},
CHECKBOX: {
id: 'checkbox',
label: 'Checkbox pattern',
href: 'https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/'
},
COMBOBOX: {
id: 'combobox',
label: 'Combobox pattern',
Expand Down
Loading