WordPressコメント欄のaria-requiredについて

WordPressのテーマ作成中。
HTML Validatorに入れたら、コメントフォーム周りで「そんな要素はない」と叱られる。
見てみると、inputにaria-required=true という設定がある。
どうやらこれはアクセシビリティーに関する指定で、IE8からサポートされるらしいが、現状では特に意味を成さないので削除。

下記サイトの説明によると、
「フォームの必須要素に指定すると、空白のまま送信しようとするとエラーを出力する」
とのこと。
今までこういうフォームバリデートはJavaScriptかサーバーサイドのプログラム側でやるしかなかったけど、HTMLレベルでやってくれるようになるとしたらラクでいいですね。

広告

大丈夫かなIE8…。

The aria-required property indicates which input fields of a form must be filled in before it can be submitted. If the user attempts to submit the form without the required information, you may set aria-invalid to indicate the error.
Note For cross-browser compatibility, always use the WAI-ARIA attribute syntax to access and modify ARIA properties, for example object.setAttribute(“aria-valuenow”, newValue).
ariaRequired Property (A, ABBR, ACRONYM, …)

About: dacelo


1 thought on “WordPressコメント欄のaria-requiredについて”

Leave a Reply

Your email address will not be published. Required fields are marked *