@markuplint/ml-spec 4.10.2 → 5.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.ja.md +24 -10
- package/ARCHITECTURE.md +24 -10
- package/CHANGELOG.md +18 -0
- package/README.md +2 -2
- package/docs/aria-algorithms.ja.md +180 -33
- package/docs/aria-algorithms.md +183 -34
- package/docs/html-algorithms.ja.md +2 -2
- package/docs/html-algorithms.md +2 -2
- package/docs/maintenance.ja.md +13 -22
- package/docs/maintenance.md +13 -22
- package/docs/spec-resolution.ja.md +37 -9
- package/docs/spec-resolution.md +45 -16
- package/docs/type-definitions.ja.md +8 -4
- package/docs/type-definitions.md +8 -4
- package/lib/algorithm/aria/accname/__tests__/test-helpers.d.ts +45 -0
- package/lib/algorithm/aria/accname/__tests__/test-helpers.js +120 -0
- package/lib/algorithm/aria/accname/aria-steps.d.ts +51 -0
- package/lib/algorithm/aria/accname/aria-steps.js +104 -0
- package/lib/algorithm/aria/accname/compute.d.ts +51 -0
- package/lib/algorithm/aria/accname/compute.js +101 -0
- package/lib/algorithm/aria/accname/element-names.d.ts +36 -0
- package/lib/algorithm/aria/accname/element-names.js +342 -0
- package/lib/algorithm/aria/accname/helpers.d.ts +98 -0
- package/lib/algorithm/aria/accname/helpers.js +330 -0
- package/lib/algorithm/aria/accname/index.d.ts +4 -0
- package/lib/algorithm/aria/accname/index.js +3 -0
- package/lib/algorithm/aria/accname/label-steps.d.ts +25 -0
- package/lib/algorithm/aria/accname/label-steps.js +66 -0
- package/lib/algorithm/aria/accname/svg-helpers.d.ts +17 -0
- package/lib/algorithm/aria/accname/svg-helpers.js +30 -0
- package/lib/algorithm/aria/accname/types.d.ts +70 -0
- package/lib/algorithm/aria/accname/types.js +2 -0
- package/lib/algorithm/aria/accname-computation.d.ts +14 -3
- package/lib/algorithm/aria/accname-computation.js +131 -8
- package/lib/algorithm/aria/aria-specs.d.ts +1 -0
- package/lib/algorithm/aria/get-aria.js +30 -4
- package/lib/algorithm/aria/get-computed-role.js +106 -26
- package/lib/algorithm/aria/get-explicit-role.d.ts +12 -0
- package/lib/algorithm/aria/get-explicit-role.js +12 -0
- package/lib/algorithm/aria/get-non-presentational-ancestor.d.ts +12 -0
- package/lib/algorithm/aria/get-non-presentational-ancestor.js +14 -2
- package/lib/algorithm/aria/get-permitted-roles-spec.d.ts +8 -4
- package/lib/algorithm/aria/get-permitted-roles-spec.js +19 -6
- package/lib/algorithm/aria/get-role-spec.js +10 -3
- package/lib/algorithm/aria/has-required-owned-elements.d.ts +2 -1
- package/lib/algorithm/aria/has-required-owned-elements.js +18 -15
- package/lib/algorithm/aria/is-presentational.d.ts +24 -0
- package/lib/algorithm/aria/is-presentational.js +31 -0
- package/lib/algorithm/aria/matches-context-role.d.ts +12 -4
- package/lib/algorithm/aria/matches-context-role.js +39 -6
- package/lib/algorithm/html/content-model-category-to-tag-names.js +1 -1
- package/lib/algorithm/html/get-content-model.d.ts +4 -2
- package/lib/algorithm/html/get-content-model.js +6 -7
- package/lib/const/accname.d.ts +29 -0
- package/lib/const/accname.js +76 -0
- package/lib/const/dom.d.ts +8 -0
- package/lib/const/dom.js +8 -0
- package/lib/const/index.d.ts +2 -0
- package/lib/const/index.js +2 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +4 -0
- package/lib/types/index.d.ts +65 -0
- package/lib/utils/directive-resolver.d.ts +23 -0
- package/lib/utils/directive-resolver.js +50 -0
- package/lib/utils/get-attr-specs-spec.js +4 -3
- package/lib/utils/get-ns.d.ts +7 -0
- package/lib/utils/get-ns.js +7 -0
- package/lib/utils/get-spec-by-tag-name.d.ts +1 -1
- package/lib/utils/merge-array.d.ts +10 -0
- package/lib/utils/merge-array.js +10 -0
- package/lib/utils/resolve-version.d.ts +11 -0
- package/lib/utils/resolve-version.js +11 -0
- package/lib/utils/schema-to-spec.d.ts +2 -0
- package/lib/utils/schema-to-spec.js +15 -4
- package/package.json +9 -7
package/ARCHITECTURE.ja.md
CHANGED
|
@@ -18,7 +18,16 @@ src/
|
|
|
18
18
|
│ └── permitted-structures.ts # content-models.schema.json から生成(ContentModel, Category)
|
|
19
19
|
├── algorithm/
|
|
20
20
|
│ ├── aria/
|
|
21
|
-
│ │ ├── accname-computation.ts #
|
|
21
|
+
│ │ ├── accname-computation.ts # アクセシブルネーム計算ファサード(DOM リゾルバ + 再入防止ガード)
|
|
22
|
+
│ │ ├── accname/ # AccName 純粋アルゴリズム(HTML-AAM §4.1)
|
|
23
|
+
│ │ │ ├── types.ts # AccnameElement/AccnameResolver インターフェース
|
|
24
|
+
│ │ │ ├── compute.ts # コアアルゴリズム: Steps 2A-2I
|
|
25
|
+
│ │ │ ├── aria-steps.ts # Steps 2B (aria-labelledby), 2D (aria-label)
|
|
26
|
+
│ │ │ ├── element-names.ts # Step 2E: 要素固有の名前(HTML-AAM §4.1)
|
|
27
|
+
│ │ │ ├── helpers.ts # 共有ユーティリティ(埋め込みコントロール、name-from-content)
|
|
28
|
+
│ │ │ ├── label-steps.ts # Step 2E: ラベル関連付け(labelable 要素)
|
|
29
|
+
│ │ │ ├── svg-helpers.ts # SVG アクセシブル名ソース判定
|
|
30
|
+
│ │ │ └── index.ts # 公開 API 再エクスポート
|
|
22
31
|
│ │ ├── aria-specs.ts # バージョン別 ARIA 仕様データの取得
|
|
23
32
|
│ │ ├── get-aria.ts # 要素レベルの ARIA 仕様解決(条件付き)
|
|
24
33
|
│ │ ├── get-computed-aria-props.ts # ARIA プロパティ解決(明示 → HTML → デフォルト)
|
|
@@ -42,6 +51,10 @@ src/
|
|
|
42
51
|
│ ├── is-palpable-elements.ts # パルパブルコンテンツ検出
|
|
43
52
|
│ ├── is-void-element.ts # ボイド要素判定(13 要素)
|
|
44
53
|
│ └── may-be-focusable.ts # フォーカス可能性ヒューリスティック
|
|
54
|
+
├── const/
|
|
55
|
+
│ ├── index.ts # 全定数の再エクスポート
|
|
56
|
+
│ ├── dom.ts # DOM 定数(ELEMENT_NODE, TEXT_NODE, 名前空間 URI)
|
|
57
|
+
│ └── accname.ts # AccName 定数(埋め込みコントロールロール、入力型、デフォルト値)
|
|
45
58
|
└── utils/
|
|
46
59
|
├── aria-version.ts # ARIA バージョン定数('1.1', '1.2', '1.3')
|
|
47
60
|
├── get-attr-specs.ts # DOM 要素の属性仕様(ラッパー)
|
|
@@ -142,7 +155,7 @@ flowchart TD
|
|
|
142
155
|
|
|
143
156
|
### 2. ARIA アルゴリズム
|
|
144
157
|
|
|
145
|
-
ARIA アルゴリズムは WAI-ARIA, HTML-AAM, SVG-AAM, AccName 1.
|
|
158
|
+
ARIA アルゴリズムは WAI-ARIA, HTML-AAM, SVG-AAM, AccName 1.2 仕様に基づくロール計算とアクセシビリティツリー管理を実装します。
|
|
146
159
|
|
|
147
160
|
| ファイル | 役割 |
|
|
148
161
|
| -------------------------------- | ------------------------------------------------------------------------------- |
|
|
@@ -155,7 +168,9 @@ ARIA アルゴリズムは WAI-ARIA, HTML-AAM, SVG-AAM, AccName 1.1 仕様に基
|
|
|
155
168
|
| `get-role-spec.ts` | スーパークラスロールチェーン付き完全ロール仕様の取得 |
|
|
156
169
|
| `has-required-owned-elements.ts` | 必須所有要素制約の検証 |
|
|
157
170
|
| `matches-context-role.ts` | 祖先チェーンにおける必須コンテキストロール条件の検証 |
|
|
158
|
-
| `accname-computation.ts` |
|
|
171
|
+
| `accname-computation.ts` | アクセシブルネーム計算ファサード(DOM リゾルバ + 再入防止ガード) |
|
|
172
|
+
| `accname/compute.ts` | 純粋 AccName アルゴリズム: HTML-AAM §4.1 の Steps 2A-2I |
|
|
173
|
+
| `accname/element-names.ts` | Step 2E: 要素固有の名前計算(HTML-AAM §4.1) |
|
|
159
174
|
| `get-aria.ts` | バージョンと条件の解決を含む要素レベル ARIA 仕様 |
|
|
160
175
|
| `is-presentational.ts` | ロールが `presentation` または `none` かどうかの判定 |
|
|
161
176
|
|
|
@@ -189,13 +204,12 @@ HTML アルゴリズムは HTML Living Standard に基づくコンテンツモ
|
|
|
189
204
|
|
|
190
205
|
## 外部依存パッケージ
|
|
191
206
|
|
|
192
|
-
| パッケージ
|
|
193
|
-
|
|
|
194
|
-
| `@markuplint/ml-ast`
|
|
195
|
-
| `@markuplint/types`
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `type-fest` | 深い不変性のための `ReadonlyDeep` ユーティリティ型 | 複数ファイル |
|
|
207
|
+
| パッケージ | 用途 | 使用箇所 |
|
|
208
|
+
| -------------------- | -------------------------------------------------- | ----------------------------- |
|
|
209
|
+
| `@markuplint/ml-ast` | XML 名前空間処理のための `NamespaceURI` 型 | `types/index.ts`, utils |
|
|
210
|
+
| `@markuplint/types` | 属性値の型定義のための `Type` 共用体 | `types/attributes.ts` 経由 |
|
|
211
|
+
| `is-plain-object` | AAM 情報のプレーンオブジェクト検出 | `get-permitted-roles-spec.ts` |
|
|
212
|
+
| `type-fest` | 深い不変性のための `ReadonlyDeep` ユーティリティ型 | 複数ファイル |
|
|
199
213
|
|
|
200
214
|
## 他パッケージとの連携
|
|
201
215
|
|
package/ARCHITECTURE.md
CHANGED
|
@@ -18,7 +18,16 @@ src/
|
|
|
18
18
|
│ └── permitted-structures.ts # Generated types from content-models.schema.json (ContentModel, Category)
|
|
19
19
|
├── algorithm/
|
|
20
20
|
│ ├── aria/
|
|
21
|
-
│ │ ├── accname-computation.ts # Accessible name computation
|
|
21
|
+
│ │ ├── accname-computation.ts # Accessible name computation facade (DOM resolver + reentrant guard)
|
|
22
|
+
│ │ ├── accname/ # AccName pure algorithm (HTML-AAM §4.1)
|
|
23
|
+
│ │ │ ├── types.ts # AccnameElement/AccnameResolver interfaces
|
|
24
|
+
│ │ │ ├── compute.ts # Core algorithm: Steps 2A-2I
|
|
25
|
+
│ │ │ ├── aria-steps.ts # Steps 2B (aria-labelledby) and 2D (aria-label)
|
|
26
|
+
│ │ │ ├── element-names.ts # Step 2E: element-specific name (HTML-AAM §4.1)
|
|
27
|
+
│ │ │ ├── helpers.ts # Shared utilities (embedded controls, name-from-content)
|
|
28
|
+
│ │ │ ├── label-steps.ts # Step 2E: label association for labelable elements
|
|
29
|
+
│ │ │ ├── svg-helpers.ts # SVG accessible name source check
|
|
30
|
+
│ │ │ └── index.ts # Re-exports public API
|
|
22
31
|
│ │ ├── aria-specs.ts # Version-specific ARIA spec data retrieval
|
|
23
32
|
│ │ ├── get-aria.ts # Element-level ARIA spec resolution with conditions
|
|
24
33
|
│ │ ├── get-computed-aria-props.ts # ARIA property resolution (explicit → HTML → default)
|
|
@@ -42,6 +51,10 @@ src/
|
|
|
42
51
|
│ ├── is-palpable-elements.ts # Palpable content detection
|
|
43
52
|
│ ├── is-void-element.ts # Void element check (13 elements)
|
|
44
53
|
│ └── may-be-focusable.ts # Focusability heuristic
|
|
54
|
+
├── const/
|
|
55
|
+
│ ├── index.ts # Re-exports all constants
|
|
56
|
+
│ ├── dom.ts # DOM constants (ELEMENT_NODE, TEXT_NODE, namespace URIs)
|
|
57
|
+
│ └── accname.ts # AccName constants (embedded control roles, input types, defaults)
|
|
45
58
|
└── utils/
|
|
46
59
|
├── aria-version.ts # ARIA version constants ('1.1', '1.2', '1.3')
|
|
47
60
|
├── get-attr-specs.ts # Attribute specs for a DOM element (wrapper)
|
|
@@ -142,7 +155,7 @@ The type system defines the structure of markup language specifications, element
|
|
|
142
155
|
|
|
143
156
|
### 2. ARIA Algorithms
|
|
144
157
|
|
|
145
|
-
ARIA algorithms implement WAI-ARIA, HTML-AAM, SVG-AAM, and AccName 1.
|
|
158
|
+
ARIA algorithms implement WAI-ARIA, HTML-AAM, SVG-AAM, and AccName 1.2 specifications for role computation and accessibility tree management.
|
|
146
159
|
|
|
147
160
|
| File | Purpose |
|
|
148
161
|
| -------------------------------- | --------------------------------------------------------------------------------- |
|
|
@@ -155,7 +168,9 @@ ARIA algorithms implement WAI-ARIA, HTML-AAM, SVG-AAM, and AccName 1.1 specifica
|
|
|
155
168
|
| `get-role-spec.ts` | Retrieves full role spec with super-class role chain |
|
|
156
169
|
| `has-required-owned-elements.ts` | Validates required owned element constraints |
|
|
157
170
|
| `matches-context-role.ts` | Validates required context role conditions in ancestor chain |
|
|
158
|
-
| `accname-computation.ts` | Accessible name computation
|
|
171
|
+
| `accname-computation.ts` | Accessible name computation facade (DOM resolver + reentrant guard) |
|
|
172
|
+
| `accname/compute.ts` | Pure AccName algorithm: Steps 2A-2I per HTML-AAM §4.1 |
|
|
173
|
+
| `accname/element-names.ts` | Step 2E: Element-specific name computation (HTML-AAM §4.1) |
|
|
159
174
|
| `get-aria.ts` | Element-level ARIA spec with version and condition resolution |
|
|
160
175
|
| `is-presentational.ts` | Checks if a role is `presentation` or `none` |
|
|
161
176
|
|
|
@@ -189,13 +204,12 @@ Utilities for merging, resolving, and caching specifications.
|
|
|
189
204
|
|
|
190
205
|
## External Dependencies
|
|
191
206
|
|
|
192
|
-
| Dependency
|
|
193
|
-
|
|
|
194
|
-
| `@markuplint/ml-ast`
|
|
195
|
-
| `@markuplint/types`
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `type-fest` | `ReadonlyDeep` utility type for deep immutability | Multiple files |
|
|
207
|
+
| Dependency | Purpose | Where Used |
|
|
208
|
+
| -------------------- | ------------------------------------------------- | ----------------------------- |
|
|
209
|
+
| `@markuplint/ml-ast` | `NamespaceURI` type for XML namespace handling | `types/index.ts`, utils |
|
|
210
|
+
| `@markuplint/types` | `Type` union for attribute value type definitions | via `types/attributes.ts` |
|
|
211
|
+
| `is-plain-object` | Plain object detection for AAM info | `get-permitted-roles-spec.ts` |
|
|
212
|
+
| `type-fest` | `ReadonlyDeep` utility type for deep immutability | Multiple files |
|
|
199
213
|
|
|
200
214
|
## Integration Points
|
|
201
215
|
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-alpha.0](https://github.com/markuplint/markuplint/compare/v4.14.1...v5.0.0-alpha.0) (2026-02-20)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **ml-spec:** add explicit return type to getContentModel to fix d.ts output ([52724e5](https://github.com/markuplint/markuplint/commit/52724e5f40813b7637862bfe5c7d40f3908113b3))
|
|
11
|
+
- **ml-spec:** fix broken getContentModel cache using WeakMap ([4074caa](https://github.com/markuplint/markuplint/commit/4074caa002fed6fd5a8b63da88ea356b544d1f57)), closes [#1022](https://github.com/markuplint/markuplint/issues/1022)
|
|
12
|
+
- **ml-spec:** gate context role transparency to ARIA 1.3 only ([0535787](https://github.com/markuplint/markuplint/commit/053578760013f308e6135fb4c482e90e0d983643))
|
|
13
|
+
- resolve additional eslint-plugin-unicorn v63 errors ([e58a72c](https://github.com/markuplint/markuplint/commit/e58a72c17c97bbec522f9513b99777fac6904d64))
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- **ml-spec,rules:** adopt ARIA 1.3 property names with 1.2 compat ([4f7e54d](https://github.com/markuplint/markuplint/commit/4f7e54d21593495d36e48fbe8ad27f8be85ab5ef))
|
|
18
|
+
- **ml-spec:** add ARIA 1.3 generic role transparency and image/img synonym ([58172f0](https://github.com/markuplint/markuplint/commit/58172f0ed3925bc3d68f5573ff0ba9b158db588b)), closes [#1265](https://github.com/markuplint/markuplint/issues/1265) [#2364](https://github.com/markuplint/markuplint/issues/2364)
|
|
19
|
+
- **ml-spec:** add context role validation with caching and transparency ([7a27e0d](https://github.com/markuplint/markuplint/commit/7a27e0d729256919c926b03a11daeeebfd513e4b))
|
|
20
|
+
- **ml-spec:** add declarative directivePatterns for parser-less framework support ([ceb9aa6](https://github.com/markuplint/markuplint/commit/ceb9aa67048e3a058b40a9e4d91eb903c8ff1861))
|
|
21
|
+
- **ml-spec:** add dpubRoles to ARIASpec type and algorithms ([f88fe77](https://github.com/markuplint/markuplint/commit/f88fe778594e032e003c09396e53e9f64d4772c8)), closes [#1490](https://github.com/markuplint/markuplint/issues/1490)
|
|
22
|
+
- **ml-spec:** add useIDLAttributeNames to ExtendedSpec type and merge logic ([ad4f563](https://github.com/markuplint/markuplint/commit/ad4f563a417e3a706f04882252aed2e89fb109c3))
|
|
23
|
+
|
|
6
24
|
## [4.10.2](https://github.com/markuplint/markuplint/compare/@markuplint/ml-spec@4.10.1...@markuplint/ml-spec@4.10.2) (2026-02-10)
|
|
7
25
|
|
|
8
26
|
**Note:** Version bump only for package @markuplint/ml-spec
|
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ Generated TypeScript types (do not edit directly):
|
|
|
54
54
|
|
|
55
55
|
**WAI-ARIA Specification Algorithms**:
|
|
56
56
|
|
|
57
|
-
- **Accessible Name Computation** - W3C AccName 1.1 compliant (
|
|
57
|
+
- **Accessible Name Computation** - W3C AccName 1.2 / HTML-AAM §4.1 compliant (`src/algorithm/aria/accname/`)
|
|
58
58
|
- **Role Computation** - Explicit/implicit role resolution with conflict handling (`src/algorithm/aria/get-computed-role.ts`)
|
|
59
59
|
- **Accessibility Tree Computation** - Element inclusion/exclusion logic (`src/algorithm/aria/is-exposed.ts`)
|
|
60
60
|
- **ARIA Property Computation** - Attribute value resolution with HTML equivalents (`src/algorithm/aria/get-computed-aria-props.ts`)
|
|
@@ -84,7 +84,7 @@ Generated TypeScript types (do not edit directly):
|
|
|
84
84
|
- **Spec Resolution**: `getSpecByTagName`, `getAttrSpecs`, `getRoleSpec`
|
|
85
85
|
- **Content Model Utilities**: `getContentModel`, `isPalpableElements`, `isVoidElement`
|
|
86
86
|
- **ARIA Utilities**: `getAria`, `getPermittedRoles`, `hasRequiredOwnedElements`
|
|
87
|
-
- **Accessibility Utilities**: `
|
|
87
|
+
- **Accessibility Utilities**: `getAccname`, `isExposed`, `mayBeFocusable`
|
|
88
88
|
- **Schema Utilities**: `schemaToSpec`, `resolveNamespace`, `validateAriaVersion`
|
|
89
89
|
- **Framework Extension**: Merges base HTML specs with framework-specific extensions
|
|
90
90
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- **WAI-ARIA 1.1 / 1.2 / 1.3** -- ロール定義、ステート、プロパティ
|
|
10
10
|
- **HTML-AAM**(HTML Accessibility API Mappings)-- HTML 要素の暗黙のロールマッピング
|
|
11
11
|
- **SVG-AAM**(SVG Accessibility API Mappings)-- SVG のアクセシビリティツリー包含ルール
|
|
12
|
-
- **AccName 1.
|
|
12
|
+
- **AccName 1.2**(Accessible Name and Description Computation)-- アクセシブル名の計算
|
|
13
13
|
- **ARIA in HTML** -- 要素ごとの許可されたロールと ARIA 属性の制約
|
|
14
14
|
|
|
15
15
|
### 設計方針
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
- 標準的な DOM `Element` インターフェースで動作し、markuplint 固有のノード型を必要としません。
|
|
20
20
|
- マークアップ言語仕様データ全体を含む `MLMLSpec` パラメータを受け取ります。
|
|
21
21
|
- バージョン固有の動作を選択するために `ARIAVersion` パラメータ(`'1.1'`、`'1.2'`、または `'1.3'`)を受け取ります。
|
|
22
|
-
- 純粋関数であり、副作用はありません(`getARIA`
|
|
22
|
+
- 純粋関数であり、副作用はありません(`getARIA` の内部キャッシュと `getAccname` の再入防止ガードを除く)。
|
|
23
23
|
|
|
24
24
|
## ロール計算パイプライン
|
|
25
25
|
|
|
@@ -86,13 +86,13 @@ ARIA アルゴリズム群の中核となる関数です。明示的ロール解
|
|
|
86
86
|
|
|
87
87
|
**競合解決チェック(順序通り):**
|
|
88
88
|
|
|
89
|
-
1. **必須コンテキストロールの検証** -- ロールに `
|
|
89
|
+
1. **必須コンテキストロールの検証** -- ロールに `requiredAccessibilityParentRole` エントリ(ARIA 1.2 では `requiredContextRole`)がある場合、親階層をチェックします。親要素が存在しない場合は `NO_OWNER` を返します。親階層がコンテキストロール条件を満たさない場合(`matchesContextRole()` 経由)、`INVALID_REQUIRED_CONTEXT_ROLE` を返します。プレゼンテーショナルな祖先は `getNonPresentationalAncestor()` 経由で透過的に走査されます。
|
|
90
90
|
|
|
91
|
-
2. **SVG アクセシビリティツリー包含** -- 有効な明示的ロールを持たない SVG
|
|
91
|
+
2. **SVG アクセシビリティツリー包含** -- 有効な明示的ロールを持たない SVG 名前空間要素について、アクセシブル名ソースがあるか(`hasSvgAccessibleNameSource()` 経由)をチェックします。具体的には `aria-label`、`aria-labelledby`、または `<title>`/`<desc>` 子要素の有無を確認します。いずれも存在しない場合、その SVG 要素はアクセシビリティツリーから除外されます(`role: null` を返す)。これは、通常省略される SVG 要素を含めるための SVG-AAM ルールを実装しています。
|
|
92
92
|
|
|
93
93
|
3. **インタラクティブ要素の保護** -- フォーカス可能な要素はプレゼンテーショナルになれません。`mayBeFocusable()` をチェックし、要素が `disabled`、`inert`、`hidden` でないことを確認します(各属性について祖先を走査)。要素がインタラクティブで disabled/inert/hidden でない場合、プレゼンテーショナルロールは暗黙のロールで上書きされ、`INTERACTIVE_ELEMENT_MUST_NOT_BE_PRESENTATIONAL` エラーが返されます。
|
|
94
94
|
|
|
95
|
-
4. **必須所有要素のチェック** -- 非プレゼンテーショナルな祖先が `requiredOwnedElements
|
|
95
|
+
4. **必須所有要素のチェック** -- 非プレゼンテーショナルな祖先が `allowedAccessibilityChildRoles`(ARIA 1.2 では `requiredOwnedElements`)を持ち、現在の要素の暗黙のロールがその必須所有要素のいずれかに一致する場合、プレゼンテーショナルロールは上書きされます。`REQUIRED_OWNED_ELEMENT_MUST_NOT_BE_PRESENTATIONAL` を返します。
|
|
96
96
|
|
|
97
97
|
5. **グローバル ARIA プロパティのチェック** -- 要素がグローバル ARIA プロパティ(例: `aria-label`、`aria-describedby`)を持つ場合、プレゼンテーショナルロールは暗黙のロールで上書きされます。`GLOBAL_PROP_MUST_NOT_BE_PRESENTATIONAL` を返します。
|
|
98
98
|
|
|
@@ -242,12 +242,12 @@ if (result.role) {
|
|
|
242
242
|
|
|
243
243
|
| `permittedRoles` の値 | 動作 |
|
|
244
244
|
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
245
|
-
| `true` | ARIA
|
|
245
|
+
| `true` | ARIA 仕様のすべての非抽象ロール(DPub ロールを含む)が許可されます。 |
|
|
246
246
|
| `PermittedARIAAAMInfo` オブジェクト | `core-aam` が `true` の場合、すべての非抽象ロールを追加。`graphics-aam` が `true` の場合、すべての非抽象グラフィックスロールを追加。 |
|
|
247
247
|
| 文字列/オブジェクトの配列 | リストに記載された特定のロールが許可されます。 |
|
|
248
248
|
| `false` | ロールは許可されません(暗黙のロール追加前は空リスト)。 |
|
|
249
249
|
|
|
250
|
-
4. 結果には常に暗黙のロールを含めます。暗黙のロールが `"presentation"` または `"none"` の場合、両方の等価ロールが含まれます。
|
|
250
|
+
4. 結果には常に暗黙のロールを含めます。暗黙のロールが `"presentation"` または `"none"` の場合、両方の等価ロールが含まれます。ARIA 1.3 では、暗黙のロールが `"img"` または `"image"` の場合、両方のシノニムが含まれます。
|
|
251
251
|
5. マージおよび重複排除されたリストを返します。
|
|
252
252
|
|
|
253
253
|
---
|
|
@@ -273,9 +273,10 @@ if (result.role) {
|
|
|
273
273
|
|
|
274
274
|
1. 指定されたバージョンの ARIA ロールリストからロール名で検索します。
|
|
275
275
|
2. SVG 名前空間(`http://www.w3.org/2000/svg`)の場合、コアロールで見つからなければ `graphicsRoles` も検索します。
|
|
276
|
-
3. `
|
|
277
|
-
4.
|
|
278
|
-
5.
|
|
276
|
+
3. それでも見つからない場合、`dpubRoles` を検索します(DPub ARIA ロールは名前空間に関係なくすべての要素で受け入れられます)。
|
|
277
|
+
4. `generalization` プロパティ経由でスーパークラスロールを再帰的に走査し、完全な継承チェーンを構築します。
|
|
278
|
+
5. すべてのオプションフィールドを未定義でないデフォルト値に正規化します(例: `!!role.isAbstract`)。`requiredAccessibilityParentRole` はスキーマの `requiredContextRole`(ARIA 1.2 名)または `requiredAccessibilityParentRole`(ARIA 1.3 名)から解決され、同様に `allowedAccessibilityChildRoles` は `requiredOwnedElements` または `allowedAccessibilityChildRoles` から解決されます。新旧両方のプロパティ名に同じ値が設定されます。
|
|
279
|
+
6. ロール名が仕様に存在しない場合は `null` を返します。
|
|
279
280
|
|
|
280
281
|
**戻り値の正規化されたフィールド:**
|
|
281
282
|
|
|
@@ -284,8 +285,10 @@ if (result.role) {
|
|
|
284
285
|
name: string;
|
|
285
286
|
isAbstract: boolean; // デフォルト: false
|
|
286
287
|
deprecated: boolean; // デフォルト: false
|
|
287
|
-
|
|
288
|
-
|
|
288
|
+
requiredAccessibilityParentRole: string[]; // デフォルト: []
|
|
289
|
+
allowedAccessibilityChildRoles: string[]; // デフォルト: []
|
|
290
|
+
requiredContextRole: string[]; // @deprecated エイリアス — requiredAccessibilityParentRole と同値
|
|
291
|
+
requiredOwnedElements: string[]; // @deprecated エイリアス — allowedAccessibilityChildRoles と同値
|
|
289
292
|
accessibleNameRequired: boolean; // デフォルト: false
|
|
290
293
|
accessibleNameFromAuthor: boolean; // デフォルト: false
|
|
291
294
|
accessibleNameFromContent: boolean;// デフォルト: false
|
|
@@ -322,7 +325,7 @@ if (result.role) {
|
|
|
322
325
|
1. `getVersionResolvedARIA()` を呼び出します。この関数は:
|
|
323
326
|
- タグ名と名前空間で要素仕様を検索します。
|
|
324
327
|
- `resolveVersion()` を適用して、ベース ARIA 仕様の上にバージョン固有のオーバーライドをマージします。
|
|
325
|
-
- 許可ロールの最適化:許可ロール配列に `"presentation"` がある場合は `"none"` を追加し、逆も同様です(WAI-ARIA 1.2 の `none` ロールに関する注記に準拠)。
|
|
328
|
+
- 許可ロールの最適化:許可ロール配列に `"presentation"` がある場合は `"none"` を追加し、逆も同様です(WAI-ARIA 1.2 の `none` ロールに関する注記に準拠)。ARIA 1.3 では、`"image"` がある場合は `"img"` を追加し、逆も同様です(ARIA 1.3 の `image`/`img` シノニムに準拠)。
|
|
326
329
|
- 結果を `localName + namespace + version` をキーとしてキャッシュします。
|
|
327
330
|
|
|
328
331
|
2. 条件付きオーバーライド(ARIA 仕様の `conditions` ブロック)を評価します:
|
|
@@ -386,25 +389,140 @@ if (result.role) {
|
|
|
386
389
|
|
|
387
390
|
---
|
|
388
391
|
|
|
389
|
-
### 10. `getAccname(el): string`
|
|
392
|
+
### 10. `getAccname(el, specs, version): string`
|
|
390
393
|
|
|
391
394
|
**ソース:** `src/algorithm/aria/accname-computation.ts`
|
|
392
395
|
|
|
393
|
-
|
|
396
|
+
HTML-AAM §4.1 アルゴリズムを使用して、DOM 要素のアクセシブル名を計算します。DOM ベースのリゾルバを作成し、純粋な `computeAccessibleName()` 関数に委譲する公開ファサードです。
|
|
394
397
|
|
|
395
398
|
**パラメータ:**
|
|
396
399
|
|
|
397
|
-
| パラメータ | 型
|
|
398
|
-
| ---------- |
|
|
399
|
-
| `el` | `Element`
|
|
400
|
+
| パラメータ | 型 | 説明 |
|
|
401
|
+
| ---------- | ------------- | ---------------------------------------- |
|
|
402
|
+
| `el` | `Element` | DOM 要素 |
|
|
403
|
+
| `specs` | `MLMLSpec` | 完全なマークアップ言語仕様 |
|
|
404
|
+
| `version` | `ARIAVersion` | ロール照会に使用する ARIA 仕様バージョン |
|
|
400
405
|
|
|
401
406
|
**戻り値:** `string` -- 計算されたアクセシブル名、または見つからない場合は空文字列。
|
|
402
407
|
|
|
403
|
-
|
|
408
|
+
**アーキテクチャ:**
|
|
409
|
+
|
|
410
|
+
実装は2つのレイヤーに分離されています:
|
|
411
|
+
|
|
412
|
+
- **`accname-computation.ts`**(ファサード): DOM ベースの `AccnameResolver` を作成し、`:aria(has name)` セレクタ循環の再入防止ガードを処理し、純粋アルゴリズムに委譲。
|
|
413
|
+
- **`accname/compute.ts`**(純粋アルゴリズム): `AccnameElement` と `AccnameResolver` インターフェースのみを使用して AccName 1.2 §4.3.2 の Steps 2A–2I を実装。DOM や markuplint 型への依存なし。
|
|
414
|
+
|
|
415
|
+
**アルゴリズム(AccName 1.2 §4.3.2):**
|
|
416
|
+
|
|
417
|
+
1. **Step 2A — 非表示判定:** 要素が非表示かつ `aria-labelledby` で参照されていない場合、空を返す。
|
|
418
|
+
2. **Step 2B – `aria-labelledby`:** 参照先要素を解決し、その名前を再帰的に計算(訪問済みセットで循環防止)。
|
|
419
|
+
3. **Step 2D – `aria-label`:** `aria-label` 属性の値が非空であればそれを使用。
|
|
420
|
+
4. **Step 2E – 要素固有の名前:** HTML-AAM §4.1 のルールを適用(ラベル関連付け、`<img alt>`、`<input value>`、`<fieldset>` legend、`<table>` caption、SVG `<title>` 等)。
|
|
421
|
+
5. **Step 2F – コンテンツからの名前:** ロールが name-from-content を許可する場合、または要素が `aria-labelledby` で参照されている場合、子ノードのテキストを再帰的に収集(Step 2C の埋め込みコントロール値抽出を含む)。
|
|
422
|
+
6. **Step 2I – title フォールバック:** `title` 属性の値を使用。
|
|
423
|
+
|
|
424
|
+
**再入防止ガード:** `getAccname` は `WeakSet<Element>` を使用して、`getComputedRole` が `:aria(has name)` セレクタを評価する際に `getAccname` を再度呼び出す無限再帰を防止します。
|
|
425
|
+
|
|
426
|
+
#### AccName アルゴリズム制御フロー
|
|
427
|
+
|
|
428
|
+
以下の図は、アクセシブル名計算アルゴリズムの全制御フローを示し、各ステップを実装ファイルにマッピングしています。
|
|
429
|
+
|
|
430
|
+
```mermaid
|
|
431
|
+
flowchart TB
|
|
432
|
+
Start([Element]) --> Facade["getAccname()\n<i>accname-computation.ts</i>"]
|
|
433
|
+
Facade --> Guard{"再入\nガード?"}
|
|
434
|
+
Guard -->|"計算中"| Empty(["'' を返す"])
|
|
435
|
+
Guard -->|"初回呼び出し"| Resolver["createDomResolver()\n<i>accname-computation.ts</i>"]
|
|
436
|
+
Resolver --> Compute["computeAccessibleName()\n<i>compute.ts</i>"]
|
|
437
|
+
|
|
438
|
+
Compute --> Hidden{"非表示 &\nlabelledby\n外?"}
|
|
439
|
+
Hidden -->|Yes| EmptyResult(["空を返す"])
|
|
440
|
+
Hidden -->|No| Precomp{"getPrecomputedName?\n<i>[実装固有]</i>"}
|
|
441
|
+
|
|
442
|
+
Precomp -->|"値あり"| PrecompResult(["事前計算名を返す"])
|
|
443
|
+
Precomp -->|"なし"| Step2B
|
|
444
|
+
|
|
445
|
+
subgraph step2b ["Step 2B — aria-labelledby (aria-steps.ts)"]
|
|
446
|
+
Step2B{"aria-labelledby\nあり &\nlabelledby\n走査外?"}
|
|
447
|
+
Step2B -->|Yes| SplitIDs["IDREF をホワイトスペースで分割"]
|
|
448
|
+
SplitIDs --> ForEachID["各 IDREF:\n• 訪問済みスキップ(自己参照は許可)\n• getElementById()\n• inLabelledby=true で再帰"]
|
|
449
|
+
ForEachID --> JoinParts["スペースで結合"]
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
Step2B -->|"なし / 空"| Step2D
|
|
453
|
+
JoinParts -->|"名前あり"| LabelledbyResult(["名前を返す\nsource: aria-labelledby"])
|
|
454
|
+
|
|
455
|
+
subgraph step2d ["Step 2D — aria-label (aria-steps.ts)"]
|
|
456
|
+
Step2D{"aria-label\n非空?"}
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
Step2D -->|Yes| AriaLabelResult(["名前を返す\nsource: aria-label"])
|
|
460
|
+
Step2D -->|No| Step2E
|
|
461
|
+
|
|
462
|
+
subgraph step2e ["Step 2E — 要素固有 (element-names.ts)"]
|
|
463
|
+
Step2E["getElementSpecificName()"]
|
|
464
|
+
Step2E --> Dispatch{"要素\n種別?"}
|
|
465
|
+
Dispatch -->|"SVG"| SVGTitle["SVG: title 子要素\n<i>SVG-AAM §8.1</i>"]
|
|
466
|
+
Dispatch -->|"input"| InputType["Input: type で分岐\n<i>HTML-AAM §4.1</i>"]
|
|
467
|
+
Dispatch -->|"button"| BtnLabel["ラベル → コンテンツ\n<i>HTML-AAM §4.1</i>"]
|
|
468
|
+
Dispatch -->|"fieldset"| Legend["legend コンテンツ\n<i>HTML-AAM §4.1</i>"]
|
|
469
|
+
Dispatch -->|"table"| Caption["caption コンテンツ\n<i>HTML-AAM §4.1</i>"]
|
|
470
|
+
Dispatch -->|"img"| ImgAlt["alt 属性\n<i>HTML-AAM §4.1</i>"]
|
|
471
|
+
Dispatch -->|"その他"| LabelAssoc["label-steps.ts:\nラベル関連付け\n<i>for= / 祖先</i>"]
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
Step2E -->|"名前あり"| ElementResult(["名前を返す\nsource: element-specific"])
|
|
475
|
+
Step2E -->|"null"| Step2F
|
|
476
|
+
|
|
477
|
+
subgraph step2f ["Step 2F/2C — コンテンツからの名前 (helpers.ts)"]
|
|
478
|
+
Step2F{"ロールが\nnameFrom: content\nを許可 OR\nlabelledby 走査中?"}
|
|
479
|
+
Step2F -->|Yes| WalkChildren["resolveNameFromContent():\n各子ノードに対して:"]
|
|
480
|
+
WalkChildren --> ChildType{"ノード\n種別?"}
|
|
481
|
+
ChildType -->|"テキスト"| TextContent["textContent を使用"]
|
|
482
|
+
ChildType -->|"埋め込み\nコントロール"| EmbedValue["getEmbeddedControlValue()\n<i>AccName §4.3.2 Step 2C</i>"]
|
|
483
|
+
ChildType -->|"要素"| RecurseChild["computeFn() で再帰;\n名前なし → collectTextContent()\n<i>[実装固有]</i>"]
|
|
484
|
+
TextContent --> JoinSpaces["スペースで結合"]
|
|
485
|
+
EmbedValue --> JoinSpaces
|
|
486
|
+
RecurseChild --> JoinSpaces
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
Step2F -->|"不可"| Step2I
|
|
490
|
+
JoinSpaces -->|"名前あり"| ContentResult(["名前を返す\nsource: content"])
|
|
491
|
+
JoinSpaces -->|"空"| Step2I
|
|
492
|
+
|
|
493
|
+
subgraph step2i ["Step 2I — title フォールバック"]
|
|
494
|
+
Step2I{"title 属性\n非空?"}
|
|
495
|
+
end
|
|
496
|
+
|
|
497
|
+
Step2I -->|Yes| TitleResult(["名前を返す\nsource: title"])
|
|
498
|
+
Step2I -->|No| FinalEmpty(["空を返す"])
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
#### W3C 仕様参照
|
|
502
|
+
|
|
503
|
+
| 仕様 | セクション | 説明 |
|
|
504
|
+
| --------------------------------------------------- | -------------- | ---------------------------------------------- |
|
|
505
|
+
| [AccName 1.2](https://www.w3.org/TR/accname-1.2/) | §4.3.2 | 計算ステップ(Steps 2A–2I) |
|
|
506
|
+
| [HTML-AAM 1.0](https://www.w3.org/TR/html-aam-1.0/) | §4.1 | アクセシブル名と説明の計算 |
|
|
507
|
+
| [HTML-AAM 1.0](https://www.w3.org/TR/html-aam-1.0/) | §4.1(要素別) | 要素固有の名前計算ルール |
|
|
508
|
+
| [SVG-AAM 1.0](https://www.w3.org/TR/svg-aam-1.0/) | §5.1.1, §8.1 | SVG アクセシビリティツリー包含と名前マッピング |
|
|
509
|
+
|
|
510
|
+
#### 実装固有の拡張
|
|
511
|
+
|
|
512
|
+
以下の動作は厳密な AccName 仕様を超えた拡張です:
|
|
513
|
+
|
|
514
|
+
| 拡張 | 場所 | 根拠 |
|
|
515
|
+
| --------------------------------------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
516
|
+
| 事前計算名 (`getPrecomputedName`) | `compute.ts` | ml-core の Pretender 統合によるフレームワークコンポーネントのサポート |
|
|
517
|
+
| 透過的テキスト収集 (`collectTextContent`) | `helpers.ts` | `nameFrom: ["content"]` を含まないロールの中間要素(例: `<button>` 内の `<span>`)からテキストを収集 |
|
|
518
|
+
| `<select>` 選択オプション (`getSelectedOptionText`) | `helpers.ts` | `selected` 属性による選択オプションテキストの静的近似。カスタマイズ可能な `<select>` ([#2069](https://github.com/markuplint/markuplint/issues/2069)) では: (1) `collectOptions` が新しい子要素型(`<button>`、`<datalist>`、`<selectedcontent>`)をスキップする必要あり、(2) `<selectedcontent>` が名前計算に影響するか評価が必要 |
|
|
519
|
+
| 再入防止ガード (`computingElements` WeakSet) | `accname-computation.ts` | `getComputedRole` → `getARIA` → `matches` チェーン内の `:aria(has name)` 擬似クラスによる無限再帰を防止 |
|
|
404
520
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
521
|
+
#### 既知の制限事項
|
|
522
|
+
|
|
523
|
+
| 制限事項 | AccName 参照 | 説明 |
|
|
524
|
+
| ------------------------------------------ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
525
|
+
| CSS 生成コンテンツ(`::before`/`::after`) | §4.3.2 Step 2G | AccName 仕様では、`::before`/`::after` 擬似要素の `content` プロパティによる CSS 生成テキストコンテンツを累積テキストに含めることが要求されています。markuplint は CSS 処理を伴わない静的 HTML 解析を行うため、このコンテンツはリント時に利用できません。CSS 生成コンテンツのみでアクセシブル名を提供している要素は検出されません。 |
|
|
408
526
|
|
|
409
527
|
---
|
|
410
528
|
|
|
@@ -448,19 +566,19 @@ WAI-ARIA アクセシブル名計算アルゴリズムを使用して、要素
|
|
|
448
566
|
|
|
449
567
|
**ソース:** `src/algorithm/aria/has-required-owned-elements.ts`
|
|
450
568
|
|
|
451
|
-
|
|
569
|
+
「Allowed Accessibility Child Roles」制約(ARIA 1.2 では「Required Owned Elements」)を検証するための関連する 2 つの関数です。
|
|
452
570
|
|
|
453
571
|
#### `hasRequiredOwnedElement`
|
|
454
572
|
|
|
455
|
-
|
|
573
|
+
要素がその計算ロールで定義された「Allowed Accessibility Child Roles」制約を満たしているかどうかをチェックします。
|
|
456
574
|
|
|
457
575
|
**アルゴリズム:**
|
|
458
576
|
|
|
459
577
|
1. 要素が `aria-owns` 属性を持つ場合、`true` を返します(部分的サポート -- 参照される要素は検証されません)。
|
|
460
578
|
2. `getComputedRole()` 経由で要素のロールを計算します。
|
|
461
|
-
3. ロールに `
|
|
462
|
-
4.
|
|
463
|
-
5.
|
|
579
|
+
3. ロールに `allowedAccessibilityChildRoles` がない場合、`true` を返します。
|
|
580
|
+
4. 要素の最も近い非プレゼンテーショナルな子孫を走査します(子要素を対象とし、所有権において透過的なロールを持つ要素は `isTransparentForOwnership()` 経由で透過的に通過)。ARIA 1.3 では `generic` 要素も透過的になります。
|
|
581
|
+
5. 各 Allowed Accessibility Child Role パターンについて、いずれかの子孫が `isRequiredOwnedElement()` 経由でマッチするかをチェックします。
|
|
464
582
|
|
|
465
583
|
#### `isRequiredOwnedElement`
|
|
466
584
|
|
|
@@ -478,7 +596,7 @@ WAI-ARIA アクセシブル名計算アルゴリズムを使用して、要素
|
|
|
478
596
|
|
|
479
597
|
**クエリ構文:** `>` 記法によるチェーンをサポートします。例えば、`"group > listitem"` は要素がロール `"group"` を持ち、ロール `"listitem"` を持つ子孫を含む必要があることを意味します。
|
|
480
598
|
|
|
481
|
-
|
|
599
|
+
**所有権の走査:** ARIA 1.1/1.2 では、WAI-ARIA 仕様は「所有(owned)」が子か子孫かを決定していません。この実装では HTML セマンティクスに合わせるため、「所有」を**子**(子孫ではなく)として解釈しています。`presentation`/`none` の子は透過的に走査されます。ARIA 1.3 では「accessibility child」と「accessibility parent」の定義が正式に導入され、さらに `generic` 要素も透過的になります(`isTransparentForOwnership()` 経由)。
|
|
482
600
|
|
|
483
601
|
---
|
|
484
602
|
|
|
@@ -507,6 +625,8 @@ WAI-ARIA アクセシブル名計算アルゴリズムを使用して、要素
|
|
|
507
625
|
4. 各レベルで、`getComputedRole()` を `assumeSingleNode = true` として呼び出し、親のロールを独立して取得します。
|
|
508
626
|
5. いずれかの条件文字列が祖先チェーンと完全に一致すれば `true` を返します。
|
|
509
627
|
|
|
628
|
+
**ARIA 1.3 の透過性:** ARIA 1.3 以降では、`generic` または `none` ロールを持つ親要素はマッチング中に透過的にスキップされます(`isTransparentForOwnership()` 経由)。ARIA 1.1/1.2 では、親要素はスキップされずに厳密にマッチされます。
|
|
629
|
+
|
|
510
630
|
**例:** `requiredContextRole: ["list", "list > group"]` を持つ `listitem` ロールの場合:
|
|
511
631
|
|
|
512
632
|
- `"list"` は親が `list` ロールを持つ場合にマッチします。
|
|
@@ -557,13 +677,37 @@ WAI-ARIA アクセシブル名計算アルゴリズムを使用して、要素
|
|
|
557
677
|
|
|
558
678
|
1. `el.parentElement` から開始します。
|
|
559
679
|
2. 各祖先について、`getComputedRole()` 経由でロールを計算します。
|
|
560
|
-
3.
|
|
680
|
+
3. 祖先のロールが所有権走査において透過的でない場合(`isTransparentForOwnership()` 経由)、その祖先の計算ロールを返します。
|
|
561
681
|
4. そうでなければ、次の親へ続行します。
|
|
562
682
|
5. 非プレゼンテーショナルな祖先が見つからない場合、`{ el: null, role: null }` を返します。
|
|
563
683
|
|
|
564
684
|
---
|
|
565
685
|
|
|
566
|
-
### 16. `
|
|
686
|
+
### 16. `isTransparentForOwnership(roleName, version): boolean`
|
|
687
|
+
|
|
688
|
+
**ソース:** `src/algorithm/aria/is-presentational.ts`
|
|
689
|
+
|
|
690
|
+
指定されたロールが所有権走査において透過的かどうかを判定します。`getNonPresentationalAncestor`、`getClosestNonPresentationalDescendants`、`matchesContextRole` がスキップすべき要素を決定するために使用します。
|
|
691
|
+
|
|
692
|
+
**パラメータ:**
|
|
693
|
+
|
|
694
|
+
| パラメータ | 型 | 説明 |
|
|
695
|
+
| ---------- | --------------------- | -------------------------- |
|
|
696
|
+
| `roleName` | `string \| undefined` | チェックする ARIA ロール名 |
|
|
697
|
+
| `version` | `ARIAVersion` | ARIA 仕様バージョン |
|
|
698
|
+
|
|
699
|
+
**戻り値:** ロールが所有権走査中にスキップされるべき場合は `true`。
|
|
700
|
+
|
|
701
|
+
**バージョンごとの動作:**
|
|
702
|
+
|
|
703
|
+
| ARIA バージョン | 透過的なロール |
|
|
704
|
+
| ---------------- | --------------------------------- |
|
|
705
|
+
| `'1.1'`、`'1.2'` | `presentation`、`none` |
|
|
706
|
+
| `'1.3'` | `presentation`、`none`、`generic` |
|
|
707
|
+
|
|
708
|
+
---
|
|
709
|
+
|
|
710
|
+
### 17. `ariaSpecs(specs, version)`
|
|
567
711
|
|
|
568
712
|
**ソース:** `src/algorithm/aria/aria-specs.ts`
|
|
569
713
|
|
|
@@ -576,9 +720,9 @@ WAI-ARIA アクセシブル名計算アルゴリズムを使用して、要素
|
|
|
576
720
|
| `specs` | `MLMLSpec` | マークアップ言語仕様全体 |
|
|
577
721
|
| `version` | `ARIAVersion` | ARIA 仕様バージョン |
|
|
578
722
|
|
|
579
|
-
**戻り値:** `{ roles: ARIARoleInSchema[], graphicsRoles: ARIARoleInSchema[], props: ARIAProperty[] }`
|
|
723
|
+
**戻り値:** `{ roles: ARIARoleInSchema[], graphicsRoles: ARIARoleInSchema[], dpubRoles: ARIARoleInSchema[], props: ARIAProperty[] }`
|
|
580
724
|
|
|
581
|
-
**実装:** `specs.def['#aria'][version]` を返し、リクエストされた ARIA
|
|
725
|
+
**実装:** `specs.def['#aria'][version]` を返し、リクエストされた ARIA バージョンに定義されたロール、グラフィックスロール、DPub ロール、およびプロパティへの直接アクセスを提供します。
|
|
582
726
|
|
|
583
727
|
## RoleComputationError リファレンス
|
|
584
728
|
|
|
@@ -636,6 +780,8 @@ function resolveVersion(aria: ARIA, version: ARIAVersion): ResolvedARIA {
|
|
|
636
780
|
### バージョンが動作に与える影響
|
|
637
781
|
|
|
638
782
|
- **`getNonPresentationalAncestor`**: ARIA 1.1/1.2 では、祖先のロール計算に完全なコンテキストを使用します(`assumeSingleNode = false`)。ARIA 1.3 以降では、各祖先が独立して計算されます(`assumeSingleNode = true`)。
|
|
783
|
+
- **`isTransparentForOwnership`**: ARIA 1.1/1.2 では `presentation`/`none` のみが透過的です。ARIA 1.3 では、WAI-ARIA の「accessibility child」と「accessibility parent」の定義に従い、`generic` も透過的になります。
|
|
784
|
+
- **`matchesContextRole`**: ARIA 1.1/1.2 では、親要素は厳密にマッチされます。ARIA 1.3 以降では、`generic`/`none` の親は透過的にスキップされます。
|
|
639
785
|
- **`namingProhibited`**: ARIA 1.2 以降でのみ適用されます。バージョン 1.1 は常にベース値を使用します。
|
|
640
786
|
- **ロールとプロパティの定義**: 利用可能なロールとそのプロパティはバージョン間で異なる場合があります(例: 1.2 や 1.3 で追加された新しいロール)。
|
|
641
787
|
|
|
@@ -646,6 +792,7 @@ ARIA アルゴリズムは以下の W3C 仕様で定義された動作を実装
|
|
|
646
792
|
- [WAI-ARIA 1.2](https://www.w3.org/TR/wai-aria-1.2/) -- Accessible Rich Internet Applications、主要リファレンス
|
|
647
793
|
- [WAI-ARIA 1.1](https://www.w3.org/TR/wai-aria-1.1/) -- 以前のバージョン、引き続きサポート
|
|
648
794
|
- [HTML-AAM 1.0](https://www.w3.org/TR/html-aam-1.0/) -- HTML Accessibility API Mappings(暗黙のロールマッピング)
|
|
649
|
-
- [AccName 1.
|
|
795
|
+
- [AccName 1.2](https://www.w3.org/TR/accname-1.2/) -- Accessible Name and Description Computation
|
|
650
796
|
- [SVG-AAM 1.0](https://www.w3.org/TR/svg-aam-1.0/) -- SVG Accessibility API Mappings
|
|
797
|
+
- [DPub-ARIA 1.1](https://w3c.github.io/dpub-aria/) -- Digital Publishing WAI-ARIA Module(DPub ロール)
|
|
651
798
|
- [ARIA in HTML](https://www.w3.org/TR/html-aria/) -- HTML 要素ごとの許可されたロールと ARIA 属性の制約
|