feat: removed aria-label from media attachment links

so that alt attributes from media attachments will take precedent
This commit is contained in:
wolfgang101 2025-05-15 16:10:47 +02:00
parent 3ca9cd8fc4
commit a20cbc72f7
2 changed files with 3 additions and 6 deletions

View File

@ -381,7 +381,6 @@ function init_scripts() {
let mediaElem = mastodonFeedCreateElement('li', media.type); let mediaElem = mastodonFeedCreateElement('li', media.type);
if('image' == media.type) { if('image' == media.type) {
let mediaElemImgLink = mastodonFeedCreateElement('a'); let mediaElemImgLink = mastodonFeedCreateElement('a');
mediaElemImgLink.setAttribute('aria-label', 'Link to Mastodon post');
let imageUrl = media.url; let imageUrl = media.url;
if('full' !== options.images.size && null !== media.preview_url) { if('full' !== options.images.size && null !== media.preview_url) {
imageUrl = media.preview_url; imageUrl = media.preview_url;
@ -389,7 +388,6 @@ function init_scripts() {
mediaElemImgLink.href = status.url; mediaElemImgLink.href = status.url;
if('image' === options.images.link) { if('image' === options.images.link) {
mediaElemImgLink.href = media.remote_url ?? media.url; mediaElemImgLink.href = media.remote_url ?? media.url;
mediaElemImgLink.setAttribute('aria-label', 'Link to Mastodon post image');
} }
let mediaElemImgImage = mastodonFeedCreateElement('img'); let mediaElemImgImage = mastodonFeedCreateElement('img');
mediaElemImgImage.src = imageUrl; mediaElemImgImage.src = imageUrl;
@ -412,7 +410,6 @@ function init_scripts() {
else if('gifv' == media.type) { else if('gifv' == media.type) {
let mediaElemGifvLink = mastodonFeedCreateElement('a'); let mediaElemGifvLink = mastodonFeedCreateElement('a');
mediaElemGifvLink.href = status.url; mediaElemGifvLink.href = status.url;
mediaElemGifvLink.setAttribute('aria-label', 'Link to Mastodon post');
let mediaElemGifv = mastodonFeedCreateElement('video', 'requiresInteraction'); let mediaElemGifv = mastodonFeedCreateElement('video', 'requiresInteraction');
if(null === media.remote_url) { if(null === media.remote_url) {
mediaElemGifv.src = media.url; mediaElemGifv.src = media.url;

View File

@ -161,10 +161,10 @@ in collaboration with @oldrup@mastodon.green
Happy [Accesssibility Day](https://accessibility.day) Happy [Accesssibility Day](https://accessibility.day)
* accessibility (fix): image alt attributes - initial implementation was faulty * accessibility (fix): image alt attributes - initial implementation was faulty
* accessibility: added alt text to image / video attachments * accessibility: added alt text to image / gifv attachments
* accessibility: added alt text to avatar images * accessibility: added alt text to avatar images
* accessibility: added descriptive aria-label to links * accessibility: added alt text to preview card media
* accessibility: added aria-label and alt text to preview cards * accessibility: added descriptive aria-labels
* accessibility: increased default text / background color contrast * accessibility: increased default text / background color contrast
* accessibility: switched from DIV to semantic OL / LI structure * accessibility: switched from DIV to semantic OL / LI structure