[ 
https://issues.apache.org/jira/browse/TOMAHAWK-1291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609009#action_12609009
 ] 

Simon Kitching commented on TOMAHAWK-1291:
------------------------------------------

The point I was making is that even with this patch, the component is not 
compliant with the spirit of the xhtml specification. Silencing schema 
validation errors by writing a blank ALT attribute is like "fixing" an 
exception by catching and ignoring it. There is a *reason* why the 
specification requires an alt property.

IMO, if people want their apps to generate valid XHTML, then they *must define* 
alt attributes on the images in their pages. If they don't do that, then 
nothing we can do can make the page *semantically* valid.

We could possibly do this:
   if (uiComponent.getAttributes().get(HTML.ALT_ATTR) == null) 
   {
     log.warn("No alt attribute defined on t:graphicImage, so the output is not 
valid xhtml."
       + " If you want valid XHTML, then define an alt attribute on the 
component.");
   }           

An alternative would be to just throw an exception, but I think that is too 
strict. People should be allowed to generate
invalid xhtml if they want.

The TOMAHAWK-1143 then should be solved differently. Again, to be truly valid 
xhtml (rather than just pass schema validation) it needs to provide a 
*meaningful* value for the alt attribute. So it needs to provide one, either by 
using a fixed alt text (eg "Tree Node Expander") [1] or by allowing the user to 
define the text on the t:tree2 component. I'm not sure which of those is more 
appropriate, as I haven't looked at t:tree2 in detail.

Generating XHTML-compliant output is a very good goal. But IMO this patch is 
just not the right solution here.

[1] localised, of course, into the user's language.



> t:graphicImage doesnot generate XHTML complaint code
> ----------------------------------------------------
>
>                 Key: TOMAHAWK-1291
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1291
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>    Affects Versions: 1.1.7-SNAPSHOT
>            Reporter: Hazem Saleh
>            Assignee: Hazem Saleh
>             Fix For: 1.1.7-SNAPSHOT
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to