a11y: add image alt attribute
This commit is contained in:
wolfgang101 2025-05-09 12:09:33 +02:00
commit c35d967bc4
2 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,7 @@
Plugin Name: Include Mastodon Feed Plugin Name: Include Mastodon Feed
Plugin URI: https://wolfgang.lol/code/include-mastodon-feed-wordpress-plugin Plugin URI: https://wolfgang.lol/code/include-mastodon-feed-wordpress-plugin
Description: Plugin providing [include-mastodon-feed] shortcode Description: Plugin providing [include-mastodon-feed] shortcode
Version: 1.11 Version: 1.12
Author: wolfgang.lol Author: wolfgang.lol
Author URI: https://wolfgang.lol Author URI: https://wolfgang.lol
License: MIT License: MIT
@ -379,6 +379,7 @@ function init_scripts() {
} }
if(null !== media.description) { if(null !== media.description) {
mediaElem.title = media.description; mediaElem.title = media.description;
mediaElem.alt = media.description;
} }
if(options.images.preserveImageAspectRatio) { if(options.images.preserveImageAspectRatio) {
let mediaElemImgImage = mastodonFeedCreateElement('img'); let mediaElemImgImage = mastodonFeedCreateElement('img');
@ -405,6 +406,7 @@ function init_scripts() {
mediaElemGifv.muted = 'muted'; mediaElemGifv.muted = 'muted';
if(null !== media.description) { if(null !== media.description) {
mediaElemGifv.title = media.description; mediaElemGifv.title = media.description;
mediaElemGifv.alt = media.description;
} }
mediaElemGifvLink.appendChild(mediaElemGifv); mediaElemGifvLink.appendChild(mediaElemGifv);
mediaElem.appendChild(mediaElemGifvLink); mediaElem.appendChild(mediaElemGifvLink);

View File

@ -5,7 +5,7 @@ Tags: mastodon, status, feed
Requires at least: 6.0 Requires at least: 6.0
Tested up to: 6.8 Tested up to: 6.8
Requires PHP: 7.4 Requires PHP: 7.4
Stable tag: 1.11 Stable tag: 1.12
License: MIT License: MIT
License URI: https://directory.fsf.org/wiki/License:Expat License URI: https://directory.fsf.org/wiki/License:Expat
@ -154,6 +154,9 @@ Use the following URL to get your ID:
== Changelog == == Changelog ==
= 1.12 =
* accessibility: added image alt attribute (thank you @oldrup@mastodon.green)
= 1.11 = = 1.11 =
* now favoring preview_url (smaler size) instead of remote_url (full size) for image previews (thank you @oldrup@mastodon.green) * now favoring preview_url (smaler size) instead of remote_url (full size) for image previews (thank you @oldrup@mastodon.green)