W3C home > Mailing lists > Public > www-svg@w3.org > December 2008

Re: Title as attribute or element?

From: Dana Lee Ling <dleeling@comfsm.fm>
Date: Sun, 07 Dec 2008 12:30:30 +1100
Message-ID: <493B2736.3030203@comfsm.fm>
To: www-svg@w3.org

Thanks, that does work. There are two catches, the first is that the 
text displays under other elements, even when a z-index is used to 
attempt to lift the text. The second is that all text everywhere that 
uses the "tooltip" class displays in FireFox 3.0.3 whenever any g text 
element on the page is hovered. Ultimately I need what a tooltip offers 
to achieve the effect I want (hovering over a circle that denotes a 
plant pops up the Latin name or other identification information).

I will wait for Mozilla to sort out whether to display <desc> or <title> 
in the tooltip and code to that decision as this college uses FireFox 
across all six campuses. I realize that this is putting standards and 
renderers in the wrong order, but the reality is that my students use 
FireFox so I will have to use what works in FireFox. Living on an island 
one learns that driving on unpaved cow paths tears up the tires, drive 
on the paved cow paths and both your tires and cars last longer. 
Whatever path someone chooses by which I can control the tooltip, that 
is the path I will take. I do make an effort to code to standards and 
use tools such as validator.nu, this is an area however in which I am 
still non-compliant. My apologies!

As a note to those trying to resolve this, having the ability to control 
a tooltip from a shape element is a real plus for hand-coder like me. 
For the eleven varieties of bananas (local names used) the difference is 
between (hypothetical code example, no such attribute as "tooltip-text"!)

<g fill="green" stroke="black" stroke-width="1px">
 <desc>Bananas fall 2008</desc>
   <circle cx="6696" cy="-6020" r="2" tooltip-text="Kaimana" />
   <circle cx="6703" cy="-6020" r="2" tooltip-text="Kudud, uht rais" />
   <circle cx="6711" cy="-6020" r="2" tooltip=text="Karat pako" />
   <circle cx="6718" cy="-6020" r="2" tooltip-text="Preisihl (Brazil)" />
   <circle cx="6700" cy="-6030" r="2" tooltip-text="Akadahn weitahtah" />
   <circle cx="6708" cy="-6030" r="2" tooltip-text="Iemwahn" />
   <circle cx="6715" cy="-6030" r="2" tooltip-text="Karat pako." />
   <circle cx="6705" cy="-6040" r="2" tooltip-text="Karat en Kariki" />
   <circle cx="6712" cy="-6040" r="2" tooltip-text="Utin Pihsi, utin 
Fiji. Kehlen, Suanrita." />
   <circle cx="6724" cy="-6050" r="2" tooltip-text="Peleu, Utin Koruhr. 
Mathew, Paulino." />
   <circle cx="6732" cy="-6050" r="2" tooltip-text="Utin Iap. Mathew, 
Paulino." />
 </g>

and....

<g fill="green" stroke="black" stroke-width="1px">
 <desc>Bananas fall 2008</desc>
   <g>
    <desc>Kaimana</desc>
    <circle cx="6696" cy="-6020" r="2"  />
   </g>
   <g>
    <desc>Kudud, uht rais</desc>
    <circle cx="6703" cy="-6020" r="2" />
   </g>
   <g>
    <desc>Karat pako</desc>
    <circle cx="6711" cy="-6020" r="2" />
   </g>
  <!-- etc....  -->
 </g>

By the way, the large coordinate values are due to synchronization with 
ten-thousandths of a minute of latitude and longitude. The Kaimana is at 
158 degrees 09.6696 minutes East longitude, 6 degrees 54.6020 minutes 
North latitude. The negative sign in the y-coordinate offsets a 
translate that flips the map ( 
http://www.comfsm.fm/~dleeling/ethnobotany/ethnogarden.xhtml ) so North 
is up (SVG coordinates are screen coordinates and run the reverse 
direction of latitude in the Northern hemisphere).

Dana

Dr. Olaf Hoffmann wrote:
> Of course, it would be very nice and helpful both
> for users and authors, if such user-agents like
> the Geckos, Opera, WebKit, Batik/Squiggle, 
> Konqueror+KSVG, the Adobe plugin would have 
> some items in the content menu about the 
> presentation of text information like the content 
> of the elements title, desc and metadata on demand.
> For example one button for 'Display text alternative
> of the complete document', another one for
> 'Display text alternatives for the current element'
> and 'Display text alternative for the current group'.
> Would be even better starting with such a display
> to be able to open the text information for parent
> elements and children elements, if required.
>
> Unfortunately such accessibility approaches and
> approaches for simple educational purposes are
> currently not present or not very useful in those
> viewers. Opera presents the title elements as
> tooltip. Batik/Squiggle title and desc. As already 
> noted, this has the tendency to give authors the
> idea, that they put content inside the title and 
> desc, that is (only) useful as a tooltip, what is
> a problem for the variant of an accessibility
> alternative text only presentation.  
>
> However, for the given examples, as far as I
> understand this, this content fits both for the
> title or the desc element and I would work
> as intended in Batik/Squiggle, noted as title in
> Opera too.
> And there is no title attribute. If present without
> a prefix and interpreted by Firefox, this indicates
> an even bigger problem, because without a 
> prefix this should be indicated as an error in
> SVG1.1, in SVGT1.2 it should be ignored.
> Especially for SVG1.1 there are maybe viewers
> having this correct and strict error processing
> rules implemented, therefore such documents
> should be never published to avoid annoyance
> for users of these proper viewers by corrupted
> documents.
>
>
> What works both in Geckos and Opera is SVG1.1 
> combined with CSS :hover for groups containing 
> text elements, something like this:
>
> CSS:
>
> g text.tooltip
> {
> display: none
> }
>
> g:hover text.tooltip
> {
> display: inline
> }
>
> SVG1.1:
>
> <g fill="violet" stroke="darkmagenta" stroke-width="1">
> <text class="tooltip" x="6965" y="-5950" 
> font-size="10">Clerodendrum inerme (ilau)</text>
>   <circle cx="6970" cy="-5950" r="2"  />
>   <circle cx="6960" cy="-5950" r="2"  />
> </g>
>
> Discussion:
> This does not work in the Adobe plugin or in Batik/Squiggle, 
> because they seem not to interprete :hover; 
> Konqueror+KSVG1 ignores the CSS completely.
> Because it is done with CSS, this pop-up functionality
> is decorative only. However because without styling the
> text information is visible and related to the group, this 
> is a not really bad solution concerning accessibility.
> SVGT1.2 has this new attributes to indicate the role
> or functionality more precisely, but for this tiny profile
> it is explicitly noted, that authors may not rely on 
> external stylesheets as required here to note the :hover.
> Therefore currently these two methods cannot be
> combined.
>
> There are several useful methods in SVG to provide
> such text information within a valid SVG document. But 
> there is no trivial method making such information accessible
> with any user-agent unfortunately.
>
>
>
>
>   

-- 

Dana Lee Ling
Professor
College of Micronesia-FSM/National site
http://www.comfsm.fm/~dleeling/ <http://www.comfsm.fm/%7Edleeling/>

Historically diverse, uniquely Micronesian and globally connected, the 
College of Micronesia-FSM is a continuously improving and student 
centered institute of higher education. The college is committed to 
assisting in the developing of the nation by providing academic, career 
and technical educational opportunity for learners in the Federated 
States of Micronesia.

Go Sharks!
Received on Sunday, 7 December 2008 01:40:14 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:41 GMT