2017-05-26 8 views
1

を失敗した私は、次のようなフィールドセットを持っている:のdivの内側のフィールドセットの伝説がpa11y WCAG 2.0

<fieldset> 
<div class="input-left"> 
    <legend class="legend-filters">Your full name:</legend> 
</div> 
<div class="input-right"> 
    <!-- some input here ... --> 
</div> 
</fieldset> 

私はそれが置かれた場所をより詳細に制御を持っているdivの内部伝説を持っています。しかし、それはdivの内部にあるとき、それはpa11y WCAG 2.0 AAテストを失敗し、次のエラーが返されます。私はdivからそれを削除すると、エラーが表示されなくなり

Fieldset does not contain a legend element. All fieldsets should contain a legend element that describes a description of the field group.

<fieldset> 
<legend class="legend-filters">Your full name:</legend> 
<div class="input-right"> 
    <!-- some input here ... --> 
</div> 
</fieldset> 

これは偽陽性ですか?または、divの伝説を持つと、実際には一部のユーザーはアクセスできなくなりますか?

編集:私のdivクラスinput-leftをに適用すると、私の必要なことができます。しかし、私は依然としてコンプライアンスレベルで必要なことを知りたいと思う。

+0

HTML validatorへのコードが、それはエラーが返されますここに置かれる "?理想的には、凡例要素はfieldset要素の直接の子孫です。 MDNは次のように言っています: "許可され​​た親:'

'、最初の子は ''の要素です。 https://developer.mozilla.org/en/docs/Web/HTML/Element/legendまた、この記事は光を放つのに役立ちます:https://www.paciellogroup.com/blog/2007/11/fieldsets-legends- and screen-readers/ –

+0

私は、凡例がデフォルトでブロック要素ではないという誤った仮定を持っていました。 MDNリンクの「許可された親」参照は、私が探していたものです。自由に適切な答えを加えてください、私はそれを選びます。 – mjoyce91

答えて

2

あなたは(あなたのコードではありませんDTDものの、そう仮定して)HTML 5.1に寄りかかっている場合は、<legend><fieldset>の最初の子である必要があります。

Contexts in which this element can be used :

As the first child of a <fieldset> element.

- あなたをドロップするとhttps://www.w3.org/TR/html51/sec-forms.html#the-legend-element

あなたがワットをより詳細に制御を持っているあなたの必要性」とはどういう意味ですか

Error: Element legend not allowed as child of element div in this context. (Suppressing further errors from this subtree.)

From line 9, column 7; to line 9, column 37

t">↩ <legend class="legend-filters">Your f

Contexts in which element legend may be used:

As the first child of a fieldset element.

関連する問題