Skip to content

Commit 97b84c9

Browse files
authored
Merge pull request #411 from freee/develop
Release Ver. 202510.0 (production)
2 parents f9810f6 + 1643bfc commit 97b84c9

File tree

20 files changed

+564
-422
lines changed

20 files changed

+564
-422
lines changed

CLAUDE.md

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is the **freee Accessibility Guidelines** repository - a comprehensive documentation project for web and mobile accessibility guidelines. The project generates multi-language (Japanese/English) HTML documentation using Sphinx, with content sourced from YAML files and converted to reStructuredText.
8+
9+
**Main branch:** `develop`
10+
11+
**Published documentation:** https://a11y-guidelines.freee.co.jp/
12+
13+
## Core Architecture
14+
15+
### Build System
16+
17+
The project uses a **two-stage build process**:
18+
19+
1. **YAML → RST conversion** (`yaml2rst` tool)
20+
- Converts YAML guideline/check/FAQ data to reStructuredText
21+
- Generates category pages, reference tables, and cross-references
22+
- Runs before Sphinx build
23+
24+
2. **RST → HTML generation** (Sphinx)
25+
- Builds Japanese docs in `ja/` directory
26+
- Builds English docs in `en/` directory
27+
- Supports both multi-page HTML and single-page HTML output
28+
29+
### Data Structure
30+
31+
```
32+
data/
33+
├── json/
34+
│ ├── guideline-categories.json # Category definitions
35+
│ ├── wcag-sc.json # WCAG success criteria mapping
36+
│ ├── faq-tags.json # FAQ tag definitions
37+
│ ├── info.json # Reference link definitions
38+
│ └── schemas/ # JSON schemas for validation
39+
│ ├── guideline.json
40+
│ ├── check.json
41+
│ └── faq.json
42+
└── yaml/
43+
├── gl/ # Guidelines by category
44+
├── checks/ # Accessibility checks
45+
└── faq/ # FAQ articles
46+
```
47+
48+
### Custom Python Libraries
49+
50+
**`tools/lib/freee_a11y_gl`** - Core library for accessibility guideline management
51+
- Models: Category, Guideline, Check, FAQ, WCAG mappings
52+
- YAML processing and validation
53+
- Relationship management between entities
54+
- Multi-language support
55+
56+
**`tools/scripts/yaml2rst`** - RST content generator
57+
- Template-based content generation using Jinja2
58+
- Converts YAML data to Sphinx-compatible RST files
59+
- Generates category pages, indexes, and cross-references
60+
61+
## Common Commands
62+
63+
### Building Documentation
64+
65+
```bash
66+
# Build both Japanese and English HTML
67+
make html
68+
69+
# Build specific language
70+
cd ja && make html
71+
cd en && make html
72+
73+
# Build single-page HTML (singlehtml)
74+
make singlehtml
75+
76+
# Clean build artifacts
77+
make clean
78+
79+
# Check that all include files are referenced
80+
make check-includes
81+
```
82+
83+
### Testing and Validation
84+
85+
```bash
86+
# Install dependencies
87+
pip install -r requirements.txt
88+
pip install -r requirements-dev.txt
89+
npm install
90+
91+
# Run Python tests (yaml2rst)
92+
cd tools/scripts/yaml2rst
93+
python run_tests.py
94+
python run_tests.py --coverage
95+
96+
# Run Python tests (freee_a11y_gl)
97+
cd tools/lib/freee_a11y_gl
98+
python -m pytest tests/
99+
100+
# Validate YAML against JSON schemas
101+
ajv validate --spec=draft2020 -s data/json/schemas/guideline.json -r data/json/schemas/common.json -d data/yaml/gl/form/label.yaml
102+
103+
# Lint reStructuredText files
104+
sphinx-lint --enable all --disable line-too-long ja/**/*.rst
105+
106+
# Lint Japanese text (textlint)
107+
npx textlint ja/source/**/*.rst
108+
109+
# Code quality (Python)
110+
black tools/
111+
isort tools/
112+
flake8 tools/
113+
mypy tools/
114+
```
115+
116+
### Development Workflow
117+
118+
The build process for each language (ja/en) follows:
119+
120+
1. `yaml2rst` generates RST files from YAML data into `source/inc/` and `source/faq/`
121+
2. `incfiles.mk` tracks dependencies
122+
3. Sphinx builds HTML from RST sources in `source/` directory
123+
4. Output goes to `build/html/` (or `build/singlehtml/`)
124+
125+
### Working with Guidelines
126+
127+
Each guideline YAML file structure:
128+
```yaml
129+
id: gl-category-name # Unique ID with gl- prefix
130+
sortKey: 1901 # Integer 1001-2199 for ordering
131+
category: form # Category identifier
132+
title:
133+
ja: "日本語タイトル"
134+
en: "English Title"
135+
platform:
136+
- web # web and/or mobile
137+
- mobile
138+
guideline:
139+
ja: "ガイドライン本文"
140+
en: "Guideline text"
141+
sc: # WCAG success criteria
142+
- 1.1.1
143+
- 1.3.1
144+
intent:
145+
ja: "意図の説明"
146+
en: "Intent explanation"
147+
checks: # Related check IDs
148+
- '0931'
149+
info: # Related info links
150+
- exp-form-labeling
151+
```
152+
153+
### Pre-commit Hooks
154+
155+
The repository uses **Husky + lint-staged** for pre-commit validation:
156+
- JSON schema validation for YAML files
157+
- Sphinx linting for RST files
158+
- Runs automatically on `git commit`
159+
160+
Configuration in `.lintstagedrc.mjs`
161+
162+
## Version Management
163+
164+
Version information is stored in `version.py`:
165+
- `guidelines_version` - Main version (e.g., 'Ver. 202508.0')
166+
- `checksheet_version` - Checksheet version
167+
- `publishedDate` - Publication date
168+
169+
This file is imported by Sphinx configuration to set document version.
170+
171+
## Internationalization
172+
173+
The project supports **Japanese (ja)** and **English (en)**:
174+
175+
- Both languages share the same data structure
176+
- YAML files contain i18n strings with `ja:` and `en:` keys
177+
- Template directory symlink: `en/source/_templates → ja/source/_templates`
178+
- Each language has its own Sphinx `conf.py` with locale settings
179+
180+
## Build Environment Notes
181+
182+
- **Locale required:** `ja_JP.UTF-8` must be installed for Japanese date formatting
183+
- **Python version:** 3.9+ (see requirements)
184+
- **Sphinx:** ~7.0 (specified in requirements.txt)
185+
- **Theme:** sphinx_rtd_theme ~3.0
186+
187+
## GitHub Actions
188+
189+
The repository uses reusable workflows for building:
190+
- `.github/workflows/reusable-build-doc.yml` - Main build workflow
191+
- Builds for specific tags/versions with configurable Python/Sphinx/theme versions
192+
- Supports artifact reuse to avoid rebuilding unchanged content
193+
- Environment variables: `BASE_URL`, `GTM_ID`, build flags
194+
195+
## Common Tasks
196+
197+
**Adding a new guideline:**
198+
1. Create YAML file in appropriate `data/yaml/gl/{category}/` directory
199+
2. Follow the guideline schema (see `data/json/schemas/guideline.json`)
200+
3. Run `make clean` and `make html` to rebuild
201+
4. Validate with `ajv validate` command
202+
203+
**Modifying templates:**
204+
1. Templates are in `yaml2rst` package (Jinja2 format)
205+
2. Export with: `yaml2rst --export-templates`
206+
3. Customize in `~/.config/freee_a11y_gl/templates/`
207+
4. Template resolution: custom → user → built-in
208+
209+
**Testing a single component:**
210+
```bash
211+
# Test yaml2rst
212+
cd tools/scripts/yaml2rst
213+
pytest tests/unit/test_specific.py -v
214+
215+
# Test freee_a11y_gl
216+
cd tools/lib/freee_a11y_gl
217+
pytest tests/ -k "test_name"
218+
```

data/yaml/checks/design/0002.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ check:
88
ja: |-
99
テキストおよび画像化されたテキストの表示色と背景色には、充分なコントラスト比が確保されている。
1010
11-
* 文字サイズが29px(22pt)以上の場合:3:1以上
12-
* 文字サイズが24px(18pt)以上で太字の場合:3:1以上
11+
* 文字サイズが24px(18pt)以上の場合:3:1以上
12+
* 文字サイズが19px(14pt)以上で太字の場合:3:1以上
1313
* その他の場合:4.5:1以上
1414
en: |-
1515
Sufficient contrast ratios are ensured for the display colors and background colors of text and images of text.
1616
17-
* For text size 29px (22pt) or larger: at least 3:1
18-
* For bold text size 24px (18pt) or larger: at least 3:1
17+
* For text size 24px (18pt) or larger: at least 3:1
18+
* For bold text size 19px (14pt) or larger: at least 3:1
1919
* In other cases: at least 4.5:1

data/yaml/checks/design/1141.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ platform:
88
check:
99
ja: |-
1010
法的行為、経済的取引、データの変更や削除を生じる機能については、取り消し、送信前の確認・修正、または送信時のエラー・チェックと修正が可能な設計になっている。
11+
12+
ここで「データの変更や削除」とは、ユーザーが簡単な操作により元の状態を完全に復元できないものを指す。簡単な操作とは、ボタン操作や、少しの文字入力などである。
1113
en: |-
1214
For functions that involve legal actions, financial transactions, or the modification and deletion of data, the design allows for cancellation, pre-submission confirmation and modification, or error checking and correction at the time of submission.
15+
16+
Here, "modification and deletion of data" refers to cases where users cannot fully restore the original state through simple operations. Simple operations include button clicks or minimal text input.
1317
conditions:
1418
- platform: web
1519
type: or
@@ -20,8 +24,12 @@ conditions:
2024
procedure:
2125
ja: |-
2226
チェック対象の画面には、法的行為、経済的取引、データの変更や削除を生じる機能が存在しない。
27+
28+
ここで「データの変更や削除」とは、ユーザーが簡単な操作により元の状態を完全に復元できないものを指す。簡単な操作とは、ボタン操作や、少しの文字入力などである。
2329
en: |-
2430
There are no functions that involve legal actions, financial transactions, or the modification and deletion of data on the screen to be checked.
31+
32+
Here, "modification and deletion of data" refers to cases where users cannot fully restore the original state through simple operations. Simple operations include button clicks or minimal text input.
2533
- type: simple
2634
id: 1141-content-01
2735
tool: misc

data/yaml/checks/product/0021.yaml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ conditions:
2727
ただし、ガイドラインを満たしていない状態であっても、以下の場合は問題として表示されませんので注意が必要です。
2828
2929
* マウスオーバーなどで背景色やテキスト色が変化する場合の、変化後のコントラスト比が不足する場合
30-
* 大きいテキストのコントラスト比が3:1以上4.5:1未満の場合
31-
32-
- freeeの場合日本語テキストを想定しているため、「大きいテキスト」を29px(22pt)以上または24px(18pt)以上の太字としているが、WCAGでは欧文テキストを想定して18pt以上または14pt以上の太字としているため、18pt以上22pt未満(太字の場合は14pt以上18pt未満)の日本語のテキストについて、Axe DevToolsはコントラスト不足を検知できない
33-
3430
* テキスト以外のコントラスト比が不足している場合
3531
3632
- アイコン、画像、画像化されたテキスト、ボタンや入力フィールドの枠線など
@@ -41,10 +37,6 @@ conditions:
4137
Note that no issue is reported in the following cases, even when the guidelines are not met.
4238
4339
* When the contrast ratio is insufficient after the text and/or background color change, e.g. after mouse hover
44-
* When the contrast ratio of large-scale text is 3:1 or more and less than 4.5:1
45-
46-
- While large-scale text is defined as 29px(22pt) or larger font, or 24px(18pt) or larger bold font within freee's product as the primary text is assumed to be in Japanese, WCAG defines it as 18pt or larger font, or 14pt or larger bold font assuming euro-languages. As Axe DevTools is based on the requirements set by the WCAG, it cannot detect insufficient color contrast of Japanese text whose font size is between 18pt and 22pt (14pt and 18pt if bold).
47-
4840
* When the contrast ratio of non-text content is insufficient.
4941
5042
- icons, images, images of text, outlines of buttons and input fields, etc.
@@ -58,12 +50,12 @@ conditions:
5850
ja: |-
5951
WebAIM Contrast Checkerで、以下の基準を満たしていることを確認した:
6052
61-
* 文字サイズが29px(22pt)以上の場合:3:1以上
62-
* 文字サイズが24px(18pt)以上で太字の場合:3:1以上
53+
* 文字サイズが24px(18pt)以上の場合:3:1以上
54+
* 文字サイズが19px(14pt)以上で太字の場合:3:1以上
6355
* その他の場合:4.5:1以上
6456
en: |-
6557
Verified that the content meets the following color contrast requirement using the WebAIM Color Contrast Checker:
6658
67-
* Font Size: 29px(22pt)or larger; 3:1 or higher
68-
* Font Size: 24px(18pt)or larger and bold; 3:1 or higher
59+
* Font Size: 24px (18pt) or larger; 3:1 or higher
60+
* Font Size: 19px (14pt) or larger and bold; 3:1 or higher
6961
* In other cases:4.5:1 or higher

data/yaml/checks/product/0441.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ conditions:
3333
id: "0441-content-00"
3434
procedure:
3535
ja: |-
36-
チェック対象の画面に存在する画像は、装飾目的のもののみである
36+
チェック対象の画面に画像が存在しない、または装飾目的のもののみである
3737
en: |-
38-
The images on the target screen are only for decorative purposes.
38+
There are no images on the target screen, or the images are only for decorative purposes.
3939
- type: and
4040
conditions:
4141
- type: or

data/yaml/gl/form/errors-cancel.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,23 @@ platform:
1010
guideline:
1111
ja: |-
1212
法的行為、経済的取引、データの変更や削除を生じる機能については、取り消し、送信前の確認・修正、または送信時のエラー・チェックと修正を可能にする。
13+
14+
ここで「データの変更や削除」とは、ユーザーが簡単な操作により元の状態を完全に復元できないものを指す。簡単な操作とは、ボタン操作や、少しの文字入力などである。
1315
en: |-
1416
For functions involving legal commitments, financial transactions, or the alteration or deletion of data, enable cancellation, pre-submission confirmation and modification, or error checking and correction at the time of submission.
17+
18+
Here, "alteration or deletion of data" refers to cases where users cannot fully restore the original state through simple operations. Simple operations include button clicks or minimal text input.
1519
sc:
1620
- 3.3.4
1721
intent:
1822
ja: |-
1923
誤操作による影響を少なくする。
24+
25+
データの変更や削除については、ユーザーが簡単な操作で完全に復元できない場合に確認などが必要となる。これは、操作にかかる時間は人によって異なるため、時間ではなく操作の簡易性と手数で判断する。
2026
en: |-
2127
Minimize the impact of misoperation.
28+
29+
For data alteration or deletion, confirmation is required when users cannot fully restore the original state through simple operations. This criterion is based on the simplicity and number of operations rather than time, as the time required for operations varies from person to person.
2230
checks:
2331
- '1141'
2432
info:

data/yaml/gl/image/mobile-text-contrast.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ guideline:
1414
- テキストの文字サイズが19px(14pt)以上で太字の場合:3:1以上
1515
- その他の場合: 4.5:1以上
1616
17-
注:モバイル・アプリケーションにおいては、デスクトップのWebと比較して文字サイズの変更方法が広く知られていると推測されること、各プラットフォームのガイドライン [#]_ [#]_ においてもWCAG 2.1に準じた基準を用いていることから、上記の基準としています。
17+
参考:
1818
19-
.. [#] `アクセシビリティ | Apple Developer Documentation <https://developer.apple.com/jp/design/human-interface-guidelines/accessibility>`__
20-
.. [#] `Accessibility – Material Design 3 <https://m3.material.io/foundations/accessible-design/patterns#f72f3851-5184-4132-b871-bc8224e062e2>`__
19+
- `アクセシビリティ | Apple Developer Documentation <https://developer.apple.com/jp/design/human-interface-guidelines/accessibility>`__
20+
- `Accessibility – Material Design 3 <https://m3.material.io/foundations/accessible-design/patterns#f72f3851-5184-4132-b871-bc8224e062e2>`__
2121
en: |-
2222
Ensure sufficient contrast between the colors of text within images and key visual elements conveying important information, and their background colors.
2323
2424
- For text size 24px (18pt) or larger: a contrast ratio of at least 3:1.
2525
- For bold text 19px (14pt) or larger: a contrast ratio of at least 3:1.
2626
- In other cases: a contrast ratio of at least 4.5:1.
2727
28-
Note: In mobile applications, it is assumed that methods for changing text size are more widely known compared to desktop web, and the guidelines of each platform [#]_ [#]_ also use standards in line with WCAG 2.1, hence the above criteria are set.
28+
References:
2929
30-
.. [#] `Accessibility | Apple Developer Documentation <https://developer.apple.com/design/human-interface-guidelines/accessibility>`__
31-
.. [#] `Accessibility – Material Design 3 <https://m3.material.io/foundations/accessible-design/patterns#f72f3851-5184-4132-b871-bc8224e062e2>`__
30+
- `Accessibility | Apple Developer Documentation <https://developer.apple.com/design/human-interface-guidelines/accessibility>`__
31+
- `Accessibility – Material Design 3 <https://m3.material.io/foundations/accessible-design/patterns#f72f3851-5184-4132-b871-bc8224e062e2>`__
3232
sc:
3333
- 1.4.3
3434
- 1.4.6

data/yaml/gl/image/text-contrast.yaml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,19 @@ guideline:
1010
ja: |-
1111
画像内のテキストや、重要な情報を伝える視覚的要素の色と背景の色に、十分なコントラストを確保する。
1212
13-
- テキストの文字サイズが29px(22pt)以上の場合: 3:1以上
14-
- テキストの文字サイズが24px(18pt)以上で太字の場合: 3:1以上
13+
- テキストの文字サイズが24px(18pt)以上の場合: 3:1以上
14+
- テキストの文字サイズが19px(14pt)以上で太字の場合: 3:1以上
1515
- その他の場合: 4.5:1以上
1616
17-
注:freeeのプロダクトやWebサイトにおいては、主に日本語が用いられているため、Understanding WCAG 2.1 [#]_ の日本語訳 [#]_ 中の訳注で示されている基準を用いています。
18-
19-
.. [#] `Understanding Success Criterion 1.4.3: Contrast (Minimum) <https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html>`__
20-
.. [#] `達成基準 1.4.3: コントラスト (最低限)を理解する <https://waic.jp/translations/WCAG21/Understanding/contrast-minimum.html>`__
17+
参考: `達成基準 1.4.3: コントラスト (最低限)を理解する <https://waic.jp/translations/WCAG21/Understanding/contrast-minimum.html>`__
2118
en: |-
2219
Ensure sufficient contrast between the colors of text within images and key visual elements conveying important information, and their background colors.
2320
24-
- For text size 29px (22pt) or larger: a contrast ratio of at least 3:1.
25-
- For bold text 24px (18pt) or larger: a contrast ratio of at least 3:1.
21+
- For text size 24px (18pt) or larger: a contrast ratio of at least 3:1.
22+
- For bold text 19px (14pt) or larger: a contrast ratio of at least 3:1.
2623
- In other cases: a contrast ratio of at least 4.5:1.
2724
28-
Note: In freee products and websites, Japanese is mainly used, so the criteria indicated in the translation notes in Understanding WCAG 2.1 [#]_ [#]_ are used.
29-
30-
.. [#] `Understanding Success Criterion 1.4.3: Contrast (Minimum) <https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html>`__
31-
.. [#] `達成基準 1.4.3: コントラスト (最低限)を理解する <https://waic.jp/translations/WCAG21/Understanding/contrast-minimum.html>`__
25+
Reference: `Understanding Success Criterion 1.4.3: Contrast (Minimum) <https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html>`__
3226
sc:
3327
- 1.4.3
3428
- 1.4.6

0 commit comments

Comments
 (0)