[whatwg] The IMG element, proposing a CAPTION attribute

Matthew Raymond mattraymond at earthlink.net
Mon Nov 13 04:13:41 PST 2006


Alexey Feldgendler wrote:
> On Fri, 10 Nov 2006 23:47:05 +0600, Steve Runyon <s.runyon at gmail.com>  
> wrote:
> 
>> Couldn't we extend the <label> element to work for images as well as form
>> elements?  The for attribute would provide the explicit link to the image
>> that would take the label's contents out-of-stream for screen readers,  
>> and would likewise (with some CSS changes, I suppose) allow the caption  
>> to be
>> positioned correctly relative to the image for visual browsers.
> 
> Today's browsers seem to have problems about <label> outside of <form>.

   I'm not aware of the problem. The worst that seems to happen when you
use a <label for=""> element with an <img> is that the <label> element
becomes just a stylable inline element. That would seem to be the best
fallback styling we can hope for in a caption/label. If you're referring
to focus passing, WF2 already places platform-specific limits on user
agents that prevent focus passing in certain situations. Because most
platforms don't give an image focus when you click on it's label (or
caption), WF2 would indirectly define <label> as not passing focus in
that situation.

   I was actually thinking of something like this:

| <figure>
|   <img id="imageid" [...]>
|   <label for="imageid">
|     Image caption text.
|   </label>
| <figure>

   ...Where fallback content is ignored by <figure>:

| <figure>
|   <table>
|     <tr><td>
|       <img id="imageid" [...]>
|     </td></tr>
|     <tr><th>
|       <label for="imageid">
|         Image caption text.
|       </label>
|     </th></tr>
|   </table>
| <figure>

   So, in the above, the UA would treat the second example as if it
where the first.



More information about the whatwg mailing list