Greasy Fork is available in English.

Image Alt to Title

Hover tooltip of image displaying alt attribute, original title, some accessibility-related properties, and URL info.

< Feedback on Image Alt to Title

Review: Good - script works

§
Posted: 2021-02-09

Interesting. But it's not working with images added by javascript, isn't it?

myfAuthor
§
Posted: 2021-02-09

It should work for all images that appear on page as "real" IMG elements and successfully load (what "should" be all "meaningful" imagery related to page content) no matter they were in static HTML or added by JS.

It will not work for most decorative (background) images or when image is covered by transparent overlay blocking hover event from reaching image. (In this case even browser native RMB context menu will not contain image related commands revealing image info.)

It will not report alt / title values if they were set by JS after image fully loaded. I don't think it happens very often, but technically is possible.

And it could break if JS in page periodically cleans image titles: this script just listens to their load event(s) and then does nothing.

If you have some example where it doesn't seem to work which you could share, let me know.

myfAuthor
§
Posted: 2022-02-16

I have identified one scenario which was not possible to catch: when author JS creates *and loads* image element *before* appending into DOM, then the load listener userscript sitting on documentElement had nothing to catch. While I suspect it must have been happening on many occasions (it quite makes sense to do this) I haven't really caught it in the wild.

Anyway, for now I changed the augmentation process to stupid global mouseenter / mouseleave listeners, so "unhovered" images are kept intact and creation procedure cannot have any negative impact anymore.

Post reply

Sign in to post a reply.