[whatwg] The IMG element, proposing a CAPTION attribute

Alexey Feldgendler alexey at feldgendler.ru
Wed Nov 22 02:56:27 PST 2006


On Tue, 21 Nov 2006 10:30:17 +0600, Matthew Raymond <mattraymond at earthlink.net> wrote:

>    There are W3C guidelines that say that UI in user agents should
> follow the UI conventions of the underlying operating system. This is
> what caused the demise of general focus passing for <label> elements
> (which was specified in HTML 4.01). As of WF2, <label> elements only
> pass focus if labels would normally have focus passing for that kind of
> control in the user's OS. (I called it "an irrational consistency", but
> I was overruled.)

Let's not think of <label> with "type" attribute or any other element which is introduced instead as of a visually element. It should be just a way of expressing the value of "title", "alt" etc with rich markup inside.

>    I don't necessarily have a problem with supporting rich tooltips, but
> my main concern is that there isn't much of a use case for it, it won't
> match UI conventions for most platforms, and fallback is a nightmare.

Looking at the number of JS libraries implementing "tooltips" with rich markup, I can say there's plenty of a use case.

>    With regard to fallback, think of how your above example would render
> if the CSS file failed to load or wasn't supported. It would probably be
> something like this:

Here is a backward compatible example of markup:

label[type="title"] { display: none; display: tooltip }

<img id="img1" src="..." title="My lovely kitten">
<label for="img1" type="title">My <strong>lovely</strong> kitten</label>

1. Today's UAs will ignore "display: tooltip" and apply "display: none" to the <label> element.
2. Future UAs will honor "display: tooltip", and the content of the <label> element will be shown in a tooltip for the image, overriding the tooltip which would be shown otherwise (the value of the "title" attribute).
3. Semantically, the title of image is considered to be "My <strong>lovely</strong> kitten" -- with rich markup inside.

>> For various popup purposes I have added <popup> element that is
>> display:none normally and has better semantic meaning so
>> we use <popup>s for such tooltips in almost all cases.

I believe that <popup> would be as presentational as <center>. The semantics of my proposed markup is that the fragment of rich text within <label> is considered the title, alternative representation, etc of the referenced element, overriding the corresponding attribute of that element. The rule that <label type="title"> should be displayed as a tooltip should be expressed by a stylesheet.


-- 
Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com



More information about the whatwg mailing list