This blog post will show you how to do it yourself.

Add the Alt Text property

In the Settings section of Umbraco, go to Media Types > Images and add a new textstring property called 'Alt Text' with the alias 'altText'

Create a component to hook into the Tree Nodes Rendering event.

using Umbraco.Core; using Umbraco.Core.Composing; using Umbraco.Web; using Umbraco.Web.Trees;

namespace Talk.Core.Composing
{

    [RuntimeLevel(MinLevel = RuntimeLevel.Run)]
    public class TreeNodeRenderingComposer : ComponentComposer<TreeNodeRenderingComponent>, IUserComposer
    { }

    public class TreeNodeRenderingComponent : IComponent
    {
        private readonly IUmbracoContextAccessor _umbracoContextAccessor;

        public TreeNodeRenderingComponent(IUmbracoContextAccessor umbracoContextAccessor)
        {
            _umbracoContextAccessor = umbracoContextAccessor;
        }

        public void Initialize()
        {
            TreeControllerBase.TreeNodesRendering += TreeControllerBase_TreeNodesRendering;
        }

        public void Terminate()
        { }

        private void TreeControllerBase_TreeNodesRendering(TreeControllerBase sender, TreeNodesRenderingEventArgs e)
        {
            if (sender.TreeAlias == "media")
            {
                foreach (var node in e.Nodes)
                {
                    if (node.NodeType == "media")
                    {
                        if (int.TryParse(node.Id.ToString(), out var nodeId) && nodeId > 0)
                        {
                            var mediaItem = _umbracoContextAccessor.UmbracoContext.Media.GetById(nodeId);
                            if (mediaItem != null)
                            {
                                if (mediaItem.ContentType.Alias != "Folder" && (!mediaItem.HasValue("altText")
                                    || string.IsNullOrWhiteSpace(mediaItem.Value<string>("altText"))))
                                {
                                    node.CssClasses.Add("alt-text-missing");
                                }
                            }
                            else
                            {
                                var contentService = Current.Services.MediaService;
                                var mediaItemFromService = contentService.GetById(nodeId);
                                if (mediaItemFromService != null && mediaItemFromService.ContentType.Alias == "Folder"
                                    && (!mediaItemFromService.HasProperty("altText")
                                    || string.IsNullOrWhiteSpace(mediaItemFromService.GetValue<string>("altText"))))
                                {
                                    node.CssClasses.Add("alt-text-missing");
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

This will add class to any image which doesn't have the 'altText' value filled in.

Create a CustomStyles folder in App_Plugins

This will allow you to change the style of the backoffice.

Add a package.manifest file to this CustomStyles folder with these contents:

{
    "css": [
        "~/App_Plugins/CustomStyles/css/customstyles.css"
    ]
}

In this folder, add a css folder and in it create a file named customstyles.css

Put this in the css file:

li.alt-text-missing i.umb-tree-icon {
    color: red;
    animation: infinite-spinning 2s infinite;
}

@keyframes infinite-spinning {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

View the changes

That should be it. To view the changes, make sure you are running in debug mode in your local environment, or increment the Client Dependency version. Reload the page using Ctrl + F5 to empty the cache and hard reload.

Paul Seal

Umbraco MVP and .NET Web Developer from Derby (UK) who specialises in building Content Management System (CMS) websites using MVC with Umbraco as a framework. Paul is passionate about web development and programming as a whole. Apart from when he's with his wife and son, if he's not writing code, he's thinking about it or listening to a podcast about it.

Proudly sponsored by

Moriyama

  • Moriyama build, support and deploy Umbraco, Azure and ASP.NET websites and applications.
AppVeyor

  • CI/CD service for Windows, Linux and macOS
  • Build, test, deploy your apps faster, on any platform.
elmah.io

  • elmah.io is the easy error logging and uptime monitoring service for .NET.
  • Take back control of your errors with support for all .NET web and logging frameworks.
uSync Complete

  • uSync.Complete gives you all the uSync packages, allowing you to completely control how your Umbraco settings, content and media is stored, transferred and managed across all your Umbraco Installations.
uSkinned

  • More than a theme for Umbraco CMS, take full control of your content and design with a feature-rich, award-nominated & content editor focused website platform.
UmbHost

  • Affordable, Geo-Redundant, Umbraco hosting which gives back to the community by sponsoring an Umbraco Open Source Developer with each hosting package sold.