Template talk:Infobox book/Archive 10
Latest comment: 2 months ago by Graham87 in topic Code read out when using a screen reader
| This is an archive of past discussions about Template:Infobox book. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
| Archive 5 | ← | Archive 8 | Archive 9 | Archive 10 | Archive 11 |
Code read out when using a screen reader
When viewing an article in Firefox with the template inserted, the following code is visible when using a screen reader (truncated for brevity):
ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=%27%27name%27%27&rft.author=%27%27author%27%27&rft.date=%27%27pub_date%27%27&rft.pub=%27%27publisher%27%27&rft.place=%27...
The above code is in the template.
As you can imagine, it's distracting to read this and looks like something is broken.
Tagging in @Graham87 for further input. KaraLG84 (talk) 19:36, 26 April 2025 (UTC)
- @KaraLG84: These are Wikipedia:COinS, which are a type of microformat. They've been interesting with screen readers for a while now; I know there accessibility was mentioned in this discussion in 2014. Unfortunately, I don't think there's much that can be done about it. CC'ing Pigsonthewing, as the main architect of this system, who has also participated in many accessibility discussions here over the years. Graham87 (talk) 03:56, 27 April 2025 (UTC)
- COinS predates microformats; I had no part in implementing the former.
- Is there not a CSS rule that can be used to prevent text from being read out? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 08:50, 27 April 2025 (UTC)
- I'm surprised actually, a screen reader is reading out a
titleattribute of an empty element without a distinct request? Izno (talk) 15:42, 27 April 2025 (UTC)- Yeah it doesn't happen any more in Chrome (which is my primary browser), but it does in Firefox. Graham87 (talk) 03:36, 28 April 2025 (UTC)
- Weird. Well, I've moved the couple of custom styles over to TemplateStyles so I've also added a display: none for the span. Does Firefox still read it out? Izno (talk) 04:26, 28 April 2025 (UTC)
- @Izno: Not any more .. thanks very much ... that seems to have done the trick! (I tested it with the latest stable versions of both JAWS and NVDA and they both don't read out the spurious text, as expected). Slightly off-topic for this page, but could you also look in to the CS1 citation templates? They don't read out the COinS metadata in NVDA under either Chrome or Firefox now, but still do so with JAWS and Firefox (but that could well be a JAWS problem, as it's Firefox support is ... interesting sometimes). Should something be done for the more general case? Surely {{infobox book}} isn't the only such template that emits metadata in that way. Unfortunately it's harder for me to test this sort of thing thoroughly now because, as I said above, it no longer happens in Chrome and Firefox isn't my primary browser. Graham87 (talk) 05:26, 28 April 2025 (UTC)
- It would be easy to do, but I'm a little leery of jumping to do so in CS1 just because that's a chunk more affected pages and etc. I think probably what should be done is to file (email? IDK) a task upstream. Again, I'm generally surprised that any titles that aren't associated with the modified use of the attribute (as with <abbr>) are being read out in any agent. Izno (talk) 05:30, 28 April 2025 (UTC)
- I should've known ... in JAWS' default settings, it reads the COinS out for citation templates in *both* Chrome and Firefox. That's because, in JAWS 2025, they recently added a so-called "feature" to announce "descriptions of elements" (i.e. the title tag) everywhere (including link titles in Wikipedia where they differ from the page title!) I bitterly complained about this by email but my message got nowhere (though I was informed about how to turn the new title reading off, which I did immediately of course). Search for the words "short description to an element on a page" in their what's new page. Your addition of "display: none " stopped the COinS from reading at {{infobox book}} even with the new feature on, which is what we want. But that can't (and shouldn't) be applied everywhere. (Here it's probably worth noting that JAWS can be customised to behave differently for each website ... but choose your default settings wisely people!). Graham87 (talk) 08:41, 28 April 2025 (UTC)
- It would be easy to do, but I'm a little leery of jumping to do so in CS1 just because that's a chunk more affected pages and etc. I think probably what should be done is to file (email? IDK) a task upstream. Again, I'm generally surprised that any titles that aren't associated with the modified use of the attribute (as with <abbr>) are being read out in any agent. Izno (talk) 05:30, 28 April 2025 (UTC)
- I can also confirm it no longer does this with NVDA. Thanks for fixing it. KaraLG84 (talk) 10:37, 28 April 2025 (UTC)
- @Izno @KaraLG84 @Graham87
- Sorry to ping you 3 months later, but display:none; will also now not show the text to the reader (which I'm unsure if it would be necessary but if it is), rather give the element that contains it the
role=noneor wrap the output in a div that you give that role as it should give it to all it's children. waddie96 ★ (talk) 09:05, 23 August 2025 (UTC)- Correction: poorly worded, rather let me expand:
display:none;orvisibility:hidden;will completely remove the content from the accessibility tree, so assistive tech (e.g. screen readers) won't see it. That's useful for decorative elements but problematic if the content is meant to be perceivable in any way like text that must be read (sample code in a code block, or even errors like the annoying pre-save transform UNIQ might actually need to be shown so the reader knows something isn't right).- waddie96 ★ (talk) 23:34, 23 August 2025 (UTC)
role="none"/role="presentation"is the better approach when you want the element (or container) to be ignored semantically, but still have its children (like text nodes) announced. Wrapping in a<div role="none">(or applying it directly to the container element) makes sense if you want to strip away the "extra" semantics without actually hiding the text.
- @Izno: Not any more .. thanks very much ... that seems to have done the trick! (I tested it with the latest stable versions of both JAWS and NVDA and they both don't read out the spurious text, as expected). Slightly off-topic for this page, but could you also look in to the CS1 citation templates? They don't read out the COinS metadata in NVDA under either Chrome or Firefox now, but still do so with JAWS and Firefox (but that could well be a JAWS problem, as it's Firefox support is ... interesting sometimes). Should something be done for the more general case? Surely {{infobox book}} isn't the only such template that emits metadata in that way. Unfortunately it's harder for me to test this sort of thing thoroughly now because, as I said above, it no longer happens in Chrome and Firefox isn't my primary browser. Graham87 (talk) 05:26, 28 April 2025 (UTC)
- Weird. Well, I've moved the couple of custom styles over to TemplateStyles so I've also added a display: none for the span. Does Firefox still read it out? Izno (talk) 04:26, 28 April 2025 (UTC)
- Yeah it doesn't happen any more in Chrome (which is my primary browser), but it does in Firefox. Graham87 (talk) 03:36, 28 April 2025 (UTC)
- Is this now fully resolved? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 11:18, 11 April 2026 (UTC)
- I'd say so, for this template. FWIW the only screen reader combo that reads out the ctx_ver ... things in citation templates is JAWS/Firefox, and that'd be a fairy small number of users (most Firefox users on Windows would be using NVDA, so I'm not that worried about it and it's probably a JAWS problem). Graham87 (talk) 14:29, 11 April 2026 (UTC)