Spoilers and Screenreaders

I have the same issues when using NVDA on Windows.


Same issue


The Discourse team think they’ve fixed it, so I’ve updated the forum software.

Is it better now?

1 Like

Doesn’t seem to be: I tried a hard refresh and a different browser, and with NVDA the only way I can get it to read the content is to mouse over it (which I think vanishingly few blind people actually do: it’s mostly just a debug thing?). If I’m reading it normally I still just get “button expanded hide content dot.” (or “button collapsed show content dot” if it’s hidden).


No change here with Voiceover either :frowning:


Following up on the meta thread, it appears that we not only have to upgrade the forum software, but also the spoiler plugin.

On our forum, Hanon wrote this:

The HTML for that looks like this:

<span class="spoiled spoiler-blurred" role="button" tabindex="0
  data-spoiler-state="blurred" aria-expanded="false"
  aria-label="Show hidden content">spoiler</span>

Whereas on meta.discourse.org, keegan posted this:

Testing this will be read

And the HTML for that looks like this:

<div class="spoiled spoiler-blurred" dir="ltr" role="button" tabindex="0"
  data-spoiler-state="blurred" aria-expanded="false"
  aria-label="Show hidden content" aria-live="polite">
    <p aria-hidden="true">Testing this will be read</p>

We’re clearly not using the same code/version they’re using.


I had updated both.

I see the same code as on meta.discourse.org.

Could it be a caching issue? But Josh said he’d tried a hard refresh…

1 Like

Wait, what? Do you see aria-live="polite" here on intfiction.org? I definitely don’t.

Yep, I do.

I’m using Chrome 111.0. I opened Dev Tools, went to the Application tab, Storage, and “Clear site data.” This logged me out, so I logged back in and navigated back to this thread. Then I switched Dev Tools to the Network tab, refreshed this thread, and inspected the keegan quote in my post #10 https://intfiction.org/t/spoilers-and-screenreaders/60866/10?u=dfabulich

Screenshot 2023-03-09 at 1.49.48 PM

I don’t see aria-live="polite" here on this forum.

I also tried the same thing in a Chrome incognito window, and then again in Firefox 110.0 in a Private Window.

(Maybe you could try using a private/incognito window, too? Possibly it only works for you when you’re logged in, due to a theming issue or something?)

It works for me in incognito. The polite only gets attached after you unspoilerify the text.

Are you seeing it load this file? https://intfiction.org/assets/plugins/discourse-spoiler-alert-220d9ab271dbb2479455f1d706b09d67c13007618a43fe385a50af524116fe92.js

Hmm. Let’s see: I didn’t inspect the code before. Yeah, when it’s expanded I am currently seeing aria-live="polite" here, but still same results with NVDA. And I clicked through to meta.discourse.org and that doesn’t read the content for me either. I could try updating NVDA: I probably don’t have a particularly recent version, but…

Edit: no, I take that back, NVDA 2022.4 seems to be the most recent.

Maybe polite is too polite? :laughing:

1 Like

Well, aria-live="assertive" doesn’t seem to help either. If it has an aria-label, NVDA seems to read that instead of the span’s contents. And looking at MDN’s aria-label page, it seems like that’s the correct thing to do: there are a bunch of warnings about how aria-label is only for use when there is no accessible text that could describe the thing, and don’t overuse it, etc.

1 Like

I’m very embarrassed! I was noticing the difference between blurred and unblurred spoiler text! :flushed:

Using iOS VoiceOver on my iPhone running iOS 16.3.1, I’m able to reproduce the bug equally here and on meta.discourse.org. I’ve captured a screen recording, and I’ve posted it on meta.discourse.org.


Any news on this? Was going to start a topic to report it, but found this one first.


Not yet. I’ll ask the Discourse team how they’re going.


aria-polite isn’t meant to be switched on and off. It signals to a screenreader that it should read a given section out loud if it changes, but it never gets a chance to see a change 'cause they’re toggling it at the same time as everything else. And I’ll say this on the discourse forum where it might do some good tomorrow.


It’s also not really the solution imo. The desired behavior would be for the spoiler blur to behave just like the details folds when expanded. Automatically reading out the revealed text is certainly a convenience, but the bug is really with the text not appearing on the screen reader’s rendering of the page. Sorry if I’m telling you stuff you already know, I just saw a fair amount of discussion on aria-polite and wanted to make sure the issue was known.


In the context of their implementation, what I described should work. When something is unblurred, they’re setting aria-hidden to false. At least in VoiceOver, that’s a sufficient change for something to be read aloud if it’s within something that has aria-live="polite". I didn’t test NVDA or JAWS.