Ensure accessible target size for controls
Malvoz opened this issue · 1 comments
Motivation
The WCAG 2.1 SC 2.5.5 Target Size requires targets for pointer input to be at least 44 by 44 in CSS pixels. Meeting this requirement has multiple benefits, it'd be great to pass this criteria for Leaflet controls.
Edit: WCAG 2.2 (though it should be noted that the 2.2 version has not reached Recommendation status yet) has a more forgiving (from a designer's point of view!) Success Criterion: 2.5.8 Target Size (Minimum) which instead requires these targets to be at least 24 by 24 in CSS pixels.
Proposed solution
Increase the size of the following controls to 44x44 px (or 24x24 per WCAG 2.2 SC 2.5.8).
- General controls:
Lines 284 to 286 in 0f904a5
- Markers:
Leaflet/src/layer/marker/Icon.Default.js
Line 26 in bc918d4
(Changing the marker'swidth
andheight
to44px
would cause it to stretch. Either the image would need to be modified orpadding
(right and left) could be modified to achieve a 44 by 44 px target.) - Popup's Close button:
Lines 517 to 518 in 0f904a5
Additional context
Increasing the default size of controls would also have the benefit of not needing extra CSS for conditional leaflet-touch
sizing (presumably, since the controls would be large enough by default). For example, the following lines could be removed:
Lines 316 to 320 in 0f904a5
Lines 359 to 362 in 0f904a5
In any case 44 by 44 px cannot be achieved for these targets (for example, for markers it can get tricky if increasing the size of the image itself is not desired, but setting a padding
is also not desired as it may cause markers to be unexpectedly interacted with since they're larger than percieved) it should be added as a known limitation in the accessibility statement.