Leaflet.markercluster icon indicating copy to clipboard operation
Leaflet.markercluster copied to clipboard

Adding "markers" for clusters in aria-label for accessibility

Open tmiaa opened this issue 3 years ago • 9 comments
trafficstars

This is adding invisible "markers" information with aria-label for each marker cluster to fix https://github.com/Leaflet/Leaflet.markercluster/issues/1006 and each marker cluster now reads better "N markers" not just "N".

tmiaa avatar Jan 09 '22 22:01 tmiaa

I tested in Narrator, attaching screen and audio capture (you may have to unmute the videos):

Before (no contextual information for marker clusters):

After (with contextual information aria-label="markers"):

Malvoz avatar Jan 13 '22 17:01 Malvoz

@ykzeng do you think you can merge this? If there's a need for more reviews, maybe @Falke-design can take a look?

Malvoz avatar Jan 13 '22 17:01 Malvoz

@Malvoz would not be better html: '<div><span aria-label="' + childCount + ' markers">' + childCount + '</span></div>'?

Falke-Design avatar Jan 13 '22 17:01 Falke-Design

@Falke-Design I wonder if there are any cases where screen readers would then announce "<childCount> markers <childCount>". That shouldn't be the case, and would probably be a screen reader bug. But the current approach wouldn't have that potential issue so I think it's fine. 👍🏼

I guess you could do html: '<div><span aria-label="' + childCount + ' markers">' + '<span aria-hidden="true"' + childCount + '</span>' + '</span></div>' to be sure in that case.

Malvoz avatar Jan 13 '22 18:01 Malvoz

Ok then the current solutions looks better 👍

Falke-Design avatar Jan 13 '22 19:01 Falke-Design

Thanks for the review @Falke-Design!

Malvoz avatar Jan 13 '22 19:01 Malvoz

@mourner This change provides the necessary contextual information to cluster markers for screen reader users (per https://github.com/Leaflet/Leaflet.markercluster/issues/1006). If you have the time, can you please merge this, since @ykzeng is not responding?

Malvoz avatar Mar 18 '22 13:03 Malvoz

@Malvoz @Falke-Design I think it would be nice to add an option so the aria-label can be set to any label of choice, e.g. other languages as well. Any suggestions?

brorlarsnicklas avatar May 11 '22 06:05 brorlarsnicklas

@brorlarsnicklas Indeed that would be an improvement, though it could be considered a separate issue as an enhancement to this PR.

Malvoz avatar May 11 '22 08:05 Malvoz