rspec/rules/S1091/rule.adoc

32 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-01-27 13:42:22 +01: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.
2021-02-02 15:02:10 +01:00
2020-06-30 12:47:33 +02:00
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.
2021-02-02 15:02:10 +01:00
2021-01-27 13:42:22 +01:00
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.
2021-02-02 15:02:10 +01:00
2020-06-30 12:47:33 +02:00
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
----
<a href="click_on_world_map.php" target="_self">
<img src="world_map.png" ismap> <!-- Noncompliant -->
</a>
----
== Compliant Solution
----
<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>
----