Re: Dropping <input usemap="">

Ian J. Wessman wrote:
> With the specific exception of buttons and file selection, as I see it 
> the intended purpose of each and every <input> element is to provide a 
> value, whether for a <form> or not.
> 
> As for image maps, their utility lies in being able to apply information 
> to a 2D space, in practice almost always an image.
> 
> Which is why I don't entirely understand why <input usemap> must always 
> result in a form submission action.

The intention of <input type=image> to be able to provide a graphical 
submit button for a form.  It's not a good idea to overload the purpose 
of an element too much because it increases the complexity of implement, 
and the input element is already heavily overloaded.

> I think that such an assumption (that the last possible piece of 
> information I seek to select in a form will be from the image map) 
> is somewhat dangerous.

That is just a possible reason that one should avoid using <input 
type=image> for selecting information, which is probably a good idea.

> If a user wishes to select a particular time zone from a map (to use 
> part of Robert's example use case), in a form that is collecting other 
> pieces of information about that user, then I contend that it is the 
> @value of the <area> that is of importance.

For the reason you gave above, it's not a good idea to try and use 
<input type=image> for this use case.

> Example HTML fragment:
> 
> <map name="m">
>   <area shape="poly" coords="100,0,120,0,120,200,100,200" title="PDT" 
> alt="Pacific Daylight Time" value="-7"> <!-- no href, but instead a 
> *value* -->
>   <area shape="poly" coords="120,0,140,0,140,200,120,200" title="MDT" 
> alt="Mountain Daylight Time" value="-6">
>   <area shape="poly" coords="140,0,160,0,160,200,120,200" title="CDT" 
> alt="Central Daylight Time" value="-5">
> </map>
> <form action="submit.cgi">
>   <input type="image" name="GMT-offset" src="worldmap.png" usemap="#m">
>  <input type="text" name="name-last" />
>  <input type="text" name="name-first" />
> </form>

I know of 2 other possible solutions, which would probably work better 
than trying to repurpose <input type=image>.  You're actually asking the 
user to select a value, and so the semantically correct element to use 
is <select>.  The user interface with the map can be provided in two ays.

1. Using <img usemap> and and javascript to attach event handlers to 
each of the area elements.  The area elements should not have href 
attributes.  When an area is activated, the event handlers update the 
appropriate select element.

2. A more advanced solution, but which isn't yet supported, will be use 
to use XBL2.  It should be possible to attach a binding to the select 
element, which can use then use a template to transform the select 
element into a world map that is controlled by javascript.

> I believe the accessibility benefits to this approach are obvious.

The accessibility benefits can already be achieved using an ordinary 
select element, which is then enhanced through JavaScript and/or XBL.

With the first method, even if the select element is visually hidden, 
assistive technology should be able to access the control.  Such users 
should also be able to use the image map, assuming they have JavaScript 
enabled.  The XBL method should also be equally accessible.

> The 'cowpath' to be 'paved' is one in which we won't find traditional 
> implementations of this using <input usemap> because everyone who has 
> been seeking this functionality has used either JavaScript or Flash to 
> achieve a similar result.

That's right.  If we actually needed to develop new features to fulfil 
this use case, looking for existing examples that use javascript or 
flash may be necessary to justify it.  But I think the use case can be 
handled fine already.

-- 
Lachlan Hunt
http://lachy.id.au/

Received on Saturday, 18 August 2007 01:07:49 UTC