Is there any way on Mastodon to automatically filter out image posts with no alt text?

Edit: think I've got my answer- thanks y'all!
Edit 2: Copy-pasting my reply to compile the solutions from the comments: The best solution for my usecase (mobile on iOS) is Martin Wenisch's fork of Phanpy (https://mastodon.cesko.digital/@mwenisch/116249807965211752 but if you're on Android the Moshidon app client is also an option and if you're on PC there's uBlock and Tampermokey scripts (https://neilzone.co.uk/2024/02/suppressing-posts-containing-images-with-no-alt-text-in-the-mastodon-advanced-web-ui-via-ublock-origin/ & https://social.jpoesen.com/@jpoesen/116250073497451531)

Martin Wenisch (@[email protected])

@[email protected] I did a quick fork of Phanpy (web client) that hides posts with images without alt text. It's on the client side: https://github.com/cheeaun/phanpy/compare/main...martinwenisch:phanpy:main I wonder if this would be an option. It'll be hard to push it to the upstream, as it's out of their scope. But if enough people would use it, I'd polish it with a settings switch and try. Deployment of the changes here: https://phanpy.muhu.digital

Mastodon Česko.Digital
@cryptids i would *love* this, but
last i looked into it, no

@det Yeah I did some looking into it and all I could find was a uBlock filter for it (and an old feature request thread on Github) :/

Shame, I guess I'll just resort to muting people or something 

@cryptids i suppose that might work
i generally just try to avoid following folks who dont do media with alt text, usually if they alt text media most of what they boost will have alt text too, even if they dont care about if others do alt text or not
@cryptids @det on the flipside, however, I’m trying out this new instance of catodon for a while, and I note that if one tries to post an image without bothering to fill in at least something in the alt text, it has a special leg that reaches out and boots you in the crotch.

[offstage whisper]

Oh wait, not a boot, it politely tells you to do your alt text you bastard

[offstage whisper again]

No bastard. It just tells you to do the alt text.

@u0421793 these offstage whispers... Do you hear them often? Are you hearing them now? 🤔

@det @cryptids

@u0421793 @cryptids very nice to see more frontends doing this
some do it, but in my opinion it should be a lot more standard for this to be the case
@cryptids Can you please share the filter?
@Luna Yeah I'll see if I can find it again and link it in a bit
Suppressing posts containing images with no alt text in the Mastodon advanced web UI via uBlock Origin

I am a happy fediverse user, and one of the things I really like about it is that many people add high quality alt text to their posts, to make them accessible.

@cryptids I do a lot of # Alt4You replying, which sometimes helps nudge people along...
@cryptids Right now I don't think so. We'd need to reach out to developers to put in a feature request, methinks. I have no idea how that works.

@cryptids would love to know, because I'm personally done with accidentally boosting non-alt posts.

I hate retracting a boost, but my ethics say: no alt, no boost

@sortius @cryptids Same. It would be so much nicer to have them filtered

@catsalad @sortius @cryptids

I have no qualms about taking an image and posting it myself with AltText if I like it enough. If the OP couldn’t be bothered I figure it’s fair game.

@sortius @cryptids

There are browser plugins to directly show the alt text and color code, if it is missing.

For Firefox and Chrome:
https://nickdenardis.com/2023/01/14/social-visual-alt-text-mastodon/

Social Visual Alt Text browser extension now supports Mastodon | Nick DeNardis

Social visual alt text browser extension now with Mastodon support!

@unixwitch @cryptids yeh, look, default Mastodon does that, that's not the problem. Unless you can make our brains not fart, this advice is useless
@sortius
I know some apps have a setting to show a warning before boosting media without alt text, but so far I'm unaware of an option to completely filter them out
@cryptids
@nightdice @cryptids yeh, but... web page mostly here, like many of us
@sortius
kinda figured, just wanted to put the info out there in case. Hopefully someone knows a decent workaround at least.
@cryptids

@sortius

Some apps ask "are you sure you want to boost". Though they don't help with the alt text that just says "photo".

I'm using fedilab

@cryptids

@cryptids Some instances, like mastodon.art, have CSS set up that puts a warning frame around media without alt text. Maybe it could be set up on your instance, or with a browser plugin? Plus, I suppose adblock for a more "nuclear" option..

@samerion @cryptids Yes, I have that CSS set up on my instance. Here it is:

.media-gallery__item-thumbnail img:not([alt]), .audio-player__canvas:not([title]), .video-player video:not([title]), .media-gallery__gifv video:not([title]), .media-gallery__item-thumbnail img[alt=""], .audio-player__canvas[title=""], .video-player video[title=""], .media-gallery__gifv video[title=""] {border: 2px dashed rgba(251, 47, 47, 0.5);box-sizing: border-box;}

@samerion @cryptids This only draws the red dashed border around the image. But with a bit of tweaking you could use this to hide the container of the toot itself. If you are not the instance maintainer, then you could ask them, or you would have to inject that CSS in some other way, like with a browser extension.

The toot will still be in the HTML, so I don't know how screen readers would process that (if that is the reason for hiding those toots).

@cryptids Our instance has "red line" markers on those images, and I think that's mostly CSS - so you can add a "user CSS" rule with a browser plugin to hide them. It might be part custom - I don't know.

There have also been guides for uBlock Origin and similar:
https://neilzone.co.uk/2024/02/suppressing-posts-containing-images-with-no-alt-text-in-the-mastodon-advanced-web-ui-via-ublock-origin/

Suppressing posts containing images with no alt text in the Mastodon advanced web UI via uBlock Origin

I am a happy fediverse user, and one of the things I really like about it is that many people add high quality alt text to their posts, to make them accessible.

@cryptids I did a quick fork of Phanpy (web client) that hides posts with images without alt text.

It's on the client side:
https://github.com/cheeaun/phanpy/compare/main...martinwenisch:phanpy:main

I wonder if this would be an option. It'll be hard to push it to the upstream, as it's out of their scope. But if enough people would use it, I'd polish it with a settings switch and try.

Deployment of the changes here:
https://phanpy.muhu.digital

Comparing cheeaun:main...martinwenisch:main · cheeaun/phanpy

A minimalistic opinionated Mastodon web client. Contribute to cheeaun/phanpy development by creating an account on GitHub.

GitHub
@cryptids on the web app you can use ublock filters to do this
@lily I'm an old lady with a computer and don't understand all of the lingo or the applications mentioned. However, if there is a solution to be had, who would I write to on Mastodon, myself, as the above-described non-techie?
@Lizette603_23 from a quick glance at the mastodon website, the following filter should work:##.status:has(.media-gallery__item-thumbnail img:not([alt]))


this will hide all posts that have an image attachment without alt text
note that if mastodon devs change the layout of the page, this might stop working

this filter is written for
uBlock Origin, which is an ad blocker
to add the filter, click on the addon's icon, then open the dashboard (three cogs icon), then go to the "My filters" tab, paste it in, and click save
uBlock Origin - Free, open-source ad blocker extension

uBlock Origin is a free, open-source ad blocker extension and content blocker. Block ads on YouTube, Twitch, and across the web with low CPU and memory usage. Available for Firefox, Edge, Opera, and Chrome via uBlock Origin Lite.

uBlock Origin
@Lizette603_23 it would be nice if the software had a built-in way to do this, but since i don't use mastodon i don't really know if it does. if it doesn't, i'm sure it could be implemented relatively trivially if it is requested from the developers
@lily So kind of you, thank you for taking the time to respond so clearly. xo

@cryptids A good question.

One can choose to be forced to provide ALT. Might be a client thing.

One small(?) thing: I’ve also noticed clients tend to offer slop-service generated ALT text. I however do prefer no ALT over confabulated slop. The null string beats the abomination.

@cryptids I don't think so, but an alternative solution is to use a browser extension like TamperMonkey that lets you inject css and/or javascript into any site.

If you were to set up a basic TamperMonkey script for the site(s) in question, the following will hide every post that has an image without alt text, or no alt attribute at all.

```
GM_addStyle('
article:has(img[alt=""]),
article:has(img:not([alt])) {
display: none;
}
');
```

See also: https://www.freecodecamp.org/news/customize-website-experience-with-tampermonkey/

How to Use Tampermonkey to Improve a Website's UI – Example Using freeCodeCamp

What is Tampermonkey? Tampermonkey is a browser extension that lets you add custom scripts to websites, making them work or look the way you want. It's like giving websites a makeover or adding new features. These scripts are called userscripts and ...

freeCodeCamp.org
@cryptids moshidon is a mobile client that can do it. unfortunately mouse doesn't know a similar thing for desktop
@cryptids I think @alice has said she has a tool for filtering out images without alt text, but I had trouble searching her posts, so the best I found was this. https://lgbtqia.space/@alice/116200750952476282
🅰🅻🅸🅲🅴 (🌈🦄) (@[email protected])

Hey Fedi! Despite my best efforts, I'm a flawed person, like any other. Just something to keep in mind. I (almost) always toot publicly, because I think sunlight is one of the best disinfectants. So, if you see me make a mistake, such as boosting or saying something incorrect, or coming across like a jerk about something, please call me out (gently if possible 😅), so I can do better. I watched a video last night about out of touch celebrities, and while I only have a tiny fraction of their reach, I think it's good to remind myself about the dangers of thinking that people's interest in my opinions correlates in any way with their truthiness.

LGBTQIA.Space

@cryptids yup, I'm using Moshidon for Android, and there's an option to hide posts without alt-text, as well as warn before posting media without alt-text.

@leon I have a 7-day auto-delete setting (except on bookmarked posts), which is probably why you couldn't find it 🫂

Also, #NotAGirl 🩷

@alice @cryptids Thanks for the details! And whoops, sorry about that.
@cryptids I can't see an obvious way to do this directly on Pleroma or GotoSocial (the instance types I run) but at least with Pleroma/Akkoma I think you could write an MRF (https://docs-develop.pleroma.social/backend/configuration/mrf/) to do it (and I'll have a go later, just to see if it's possible.)

(Had a look in the Mastodon code but can't see anything obvious there either.)
Message Rewrite Facility - Pleroma Documentation

@cryptids when using moshidon I don't display images by default, so I see the alt text (or lack thereof) first

@cryptids

Not as far as I know, though some servers highlight them with a warning around the border of the picture.

@cryptids

Was using a Tampermonkey script. Now just use a browser extension ("Social visual alt text") that displays the alt-text inline. This, of course, only works in a browser that supports extensions, not a stand-alone client.

The settings provide for one background color of the inline portion if there is alt-text, another if there is not. So just have mine set to bright red if none. So at least there's a ready visual indication of alt-text being absent.

@cryptids Hey, so what was the solution you found? I'd love to know.
@trishalynn The best solution for my usecase (mobile on iOS) is Martin Wenisch's fork of Phanpy (https://mastodon.cesko.digital/@mwenisch/116249807965211752 but if you're on Android I've been told the Moshidon app client has a feature for this and if you're on PC there's uBlock and Tampermokey scripts (https://neilzone.co.uk/2024/02/suppressing-posts-containing-images-with-no-alt-text-in-the-mastodon-advanced-web-ui-via-ublock-origin/ & https://social.jpoesen.com/@jpoesen/116250073497451531)
Martin Wenisch (@[email protected])

@[email protected] I did a quick fork of Phanpy (web client) that hides posts with images without alt text. It's on the client side: https://github.com/cheeaun/phanpy/compare/main...martinwenisch:phanpy:main I wonder if this would be an option. It'll be hard to push it to the upstream, as it's out of their scope. But if enough people would use it, I'd polish it with a settings switch and try. Deployment of the changes here: https://phanpy.muhu.digital

Mastodon Česko.Digital

@cryptids Ooh, I didn't realize uBlock could do that. I have uBlock Origin Lite for Firefox on macOS and Windows; would that do the same thing?

I might have to go bug the Ivory for iOS devs to see if they have that ability as well.