Nael Ramadan wrote:
1.
Dear listner,
My JSF pages must satisify 508 accessibility requirement through the use
of the html label tag.
In html, you wrap the html component (i.e. <input type=radio
id="id_name" ..>) with the <label for="id_name"> .. </label> tag where
the "id" links the label with the component. This allows ease of
selection where users would just have to click on the label of the html
component in order to select the component.
So how is this achieved in JSF?
When JSF renders an html equivalent components (i.e.
h:selectOneRadioButton) into html, the component is surrounded
automatically with <label>..</label> tag but without the "for" attribute.
How can I get around this issue such that I can control the <label> and
not the JSF rendering engine?
I tried surrounding the component with <h:outputLabel for=..> ..
</h:outputLabel> but JSF pretty much seems to ignore it.
Do I need to create my own custom JSF component?
When a <label> tag *wraps* am HTML tag then there is *no need* for a
"for" attribute - the tag the label refers to is obvious. This is
standard HTML, not JSF-specific. I'm sure your 508 spec does NOT require
the "for" attribute if the label tag wraps the target tag.
If the label tag cannot wrap its target tag for any reason, then (and
only then) the "for" attribute is needed.
http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/tlddocs/index.html
Regards,
Simon