rspec/rules/S1091/html/rule.adoc

64 lines
1.7 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
The ``++ismap++`` attribute in an ``++img++`` tag creates a server-side image map: The browser sends the coordinates of the clicked point to the server.
For any person who cannot use a mouse, this form of navigation is inaccessible because it is the position of the cursor on the image that determines the action.
On the other hand, client-side image maps, which use the ``++usemap++`` attribute allow for each clickable area to specify an alternate text, enabling accessibility for the blind.
Further, in terms of separation of concerns, it is definitely better to leave the task of mapping pixels to links to the client.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,html]
2021-04-28 16:49:39 +02:00
----
<a href="click_on_world_map.php" target="_self">
<img src="world_map.png" ismap> <!-- Noncompliant -->
</a>
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,html]
2021-04-28 16:49:39 +02:00
----
<img src="world_map.png" usemap="#world_map">
<map name="world_map">
<area shape="rect" coords="0,0,10,10" href="france.html" alt="France">
<area shape="circle" coords="20,20,10" href="spain.html" alt="Spain">
<area shape="circle" coords="30,30,8" href="england.html" alt="England">
<!-- ... -->
</map>
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use the "map" tag and "area" tags instead.
'''
== Comments And Links
(visible only on this page)
=== is duplicated by: S1925
=== on 19 Jun 2013, 12:49:16 Dinesh Bolkensteyn wrote:
http://www.jimthatcher.com/webcourse5.htm
=== on 19 Jun 2013, 13:29:36 Dinesh Bolkensteyn wrote:
Ann is going to review this description.
=== on 8 Jul 2013, 18:22:19 Freddy Mallet wrote:
Is implemented by \http://jira.codehaus.org/browse/SONARPLUGINS-2991
endif::env-github,rspecator-view[]