Skip to content

Commit 9d86ef8

Browse files
authored
fix: a11y-form-control-in-form でFilterDropdownをformとして扱うように修正 (#151)
1 parent 3badfb7 commit 9d86ef8

File tree

2 files changed

+9
-0
lines changed
  • rules
    • a11y-form-control-in-form
    • a11y-prohibit-sectioning-content-in-form

2 files changed

+9
-0
lines changed

rules/a11y-form-control-in-form/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const FORM_EXPECTED_NAMES = {
1414
'((F|^f)orm)$': '(Form)$',
1515
'(FormDialog)$': '(FormDialog)$',
1616
'RemoteTrigger(.*)FormDialog$': 'RemoteTrigger(.*)FormDialog$',
17+
'FilterDropdown$': '(FilterDropdown)$',
1718
}
1819
const EXPECTED_NAMES = {
1920
...FORM_CONTROL_EXPECTED_NAMES,

rules/a11y-prohibit-sectioning-content-in-form/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ module.exports = {
166166
context.report({
167167
node,
168168
message: `${isSection ? elementName : `${asAttr.name.name}="${asAttr.value.value}"`}とその内部に存在するHeadingをsmarthr-ui/Fieldsetに置き換えてください
169+
- もしくはform要素を利用していない場合、フォームを構成する入力要素郡すべてを一つのform要素で囲んでください
170+
- required属性、pattern属性など一部属性はform要素で囲まないと動作しません
171+
- 送信用ボタンのonClickをform要素のonSubmitに移動し、送信用ボタンに `type="submit"` を指定することでより適切にマークアップ出来ます
172+
- その際、onSubmitの動作中で "e.preventDefault()" と "e.stopPropagation()" を指定する必要がある場合があります。
169173
- form内の見出しとなる要素をlegend, labelのみに統一することでスクリーンリーダーのジャンプ機能などの利便性が向上します
170174
- smarthr-ui/Fieldset が利用できない場合、fieldset要素とlegend要素を使ったマークアップに修正してください
171175
- その際、fieldset要素の直下にlegend要素が存在するようにしてください。他要素がfieldsetとlegendの間に存在すると、正しく紐づけが行われない場合があります`,
@@ -181,6 +185,10 @@ module.exports = {
181185
context.report({
182186
node: sectioningContent.node,
183187
message: `${sectioningContent.elementName}とその内部に存在するHeadingをsmarthr-ui/Fieldsetに置き換えてください
188+
- もしくはform要素を利用していない場合、フォームを構成する入力要素郡すべてを一つのform要素で囲んでください
189+
- required属性、pattern属性など一部属性はform要素で囲まないと動作しません
190+
- 送信用ボタンのonClickをform要素のonSubmitに移動し、送信用ボタンに `type="submit"` を指定することでより適切にマークアップ出来ます
191+
- その際、onSubmitの動作中で "e.preventDefault()" と "e.stopPropagation()" を指定する必要がある場合があります。
184192
- form内の見出しとなる要素をlegend, labelのみに統一することでスクリーンリーダーのジャンプ機能などの利便性が向上します
185193
- smarthr-ui/Fieldset が利用できない場合、fieldset要素とlegend要素を使ったマークアップに修正してください
186194
- その際、fieldset要素の直下にlegend要素が存在するようにしてください。他要素がfieldsetとlegendの間に存在すると、正しく紐づけが行われない場合があります`,

0 commit comments

Comments
 (0)