There is already a template rule, which allows to define rules for tracking disallowed attributes (Web:IllegalAttributeCheck). However, for accessibility and other use cases, you often need the opposite: the ability to detect missing attributes that are expected but not present.
Example:
<ui:define name="headextension">
<f:metadata>
<f:viewParam name="id" value="#{baseManagedBean.id}" />
</f:metadata>
</ui:define>
<ui:define name="content">
<div class="card">
<h5>Basic</h5>
<p:inputText />
<h5>Floating Label</h5>
<span class="ui-float-label">
<p:inputText id="float-input" value="#{inputTextView.text}" />
<p:outputLabel for="@previous" value="Username" />
</span>
<h5>Left Icon</h5>
<span class="ui-input-icon-left">
<i class="pi pi-search" />
<p:inputText placeholder="Search" />
</span>
<h5>Help Text</h5>
<div class="field">
<p:outputLabel styleClass="block">Username</p:outputLabel>
<p:inputText id="username1" styleClass="block" />
<small class="block">Enter your username to reset your password.</small>
</div>
<h5>Disabled</h5>
<p:inputText disabled="true" />
<h5>Image-Examples</h5>
<div class="card">
<p:graphicImage name="images/nature/nature4.jpg" library="demo" />
</div>
</div>
</ui:define>
</ui:composition>
In this example it is:
- Missing for-attribute on outputlabel
- Missing id-attributes on inputText
- Missing alt-attribute on grphicImage
In XPath rule template for HTML I have posted a more general approach (using xpath) but maybe just providing this special template rule, would be enough.
Thank you for having a look on that.
Best regards,
Andreas