Accessibility: Need way to browse between messages quickly

This is split out from the master accessibility thread: Accessibility audit and shepherd for making improvements.

This issue applies to when you’re looking at a topic with a bunch of replies. A page like this:

The easiest thing to do would be to use a structure similar to the following, and using proper aria landmarks and labels.

Each topic starter is followed by a sequence of replies, each of which may have replies. Tree structures like this are always messy to display. Here I’ll just concern myself with the starter and sequence of first-level responses.

The biggest issue with current implementation is that there is no way, using a screen reader, to quickly browse from message to message efficiently.

One approach would use just div with proper landmarks and labels. Another possibility would be to insert separators (<hr tags for instance) at the start of each message, just before the username. The idea is that there needs to be some sort of target which screen readers can search for via a simple single-key command. For instance, screen readers can search among headings, landmarks, list items, separators (hr tags), buttons, links with a single keystroke. It is also helpful to allow the addition of labels which can help the user keep track of where she is in a chain of replies. The following example structure attempts to do just that.

<div class="topic" role="region"> 
<h1 class="title">Looking for an ideal job that fits to lifes purpose</h1>
<div class="topic-starter message" role="region" aria-label="topic starter">
<p>... sequence of paragraphs ...</p>
<nav class="message-controls" aria-label="message controls"> ... </nav>
</div>
<div class="replies" role="region" aria-label="replies">
<header> <!-- this contains all the stats like creator, number of replies, last reply, etc --> </header>
<div class="message" role="region" aria-label="reply 1">
<h2>[user name], 8h, Post is unread</h2>
<p>... sequence of paragraphs ...</p>
<nav class="message-controls" aria-label="message controls"> ... </nav>
</div>
<div class="message" role="region" aria-label="reply 2">
<h2>[user name], 12h, Post is unread</h2>
<p>... sequence of paragraphs ...</p>
<nav class="message-controls" aria-label="message controls"> ... </nav>
</div>  ... etc ...  </div>
<!-- .replies -->
</div><!-- .topic --> 

As I understand this, without some markup to help the screen reader, it essentially drowns the user in all the incidental details along the way (eg, those stats bars, the text in reply features and things like that). All the things that are less salient visually.

The best first suggestion I have here for a solution is to look at markup that would make some of those statistics not read aloud by the screen reader, or nested at a lower level to allow browsing. We might also need more input from users about what good browsing would look like here (since there aren’t titles to each reply, maybe browsing is just the list of author and date, and then users can drill in more with the screen reader to read the body of the reply).

Did you press f12 in your browser and inspect? This already exists in the markup.

@codinghorror Can you help me see what you’re seeing? I’m familiar with web inspector and how to look at markup, but don’t see anything relevant with either of these selectors (testing on this thread for full meta effect :wink: )

document.querySelectorAll(’[role]’)

This only returns one node. Is there something else you’re thinking of in the markup that you could share, or a JS query that could show me what you’re looking at?

Also, this issue came up from a user using our Discourse instance with a screen reader, so it’s also possible that we haven’t yet accurately translated that issue into “here’s what’s up in the HTML and here’s what we need to change.” So for now my understanding is that the issue is there aren’t ARIA landmarks and roles, and that JS query above is how I’m quantifying that test for this page.

Thanks for helping work this out!

So, I have a question. What does role=region actually do?

In the following screenshot, I’ve marked up several non-primary content areas at the top of this topic.

It seems to me like the topic map (marked orange) and the post controls (marked green) would be the top priority for having the screen reader treat as “There’s more stuff here, do something if you want me to read it”.

Does role=region perform that nesting?

I don’t think we should perform nesting on the actual body of posts, as you have in your example, but rather provide navigation between posts.


Also, your example isn’t accurately showing the current HTML structure. The actual structure looks like this:

<div id=topic-title></div>
<section id=topic>
 <!-- ... some nesting is elided ... -->
 <div class=topic-post><article id=post_1>
  <div class=topic-avatar></div>
  <div class=topic-meta-data>
    // avatar, post time, wiki marker
  </div>
  <div class=cooked> ... </div>
  <!-- First thing we want to collapse -->
  <section class=post-menu-area> ... like, bookmark, reply ... </section>
  <div class=post-links-container>
   <ul> .. internal backlinks to other topics ..
  </ul></div>
  <!-- Second thing we want to collapse -->
  <div class=topic-map>
    created 6d, last reply 38m, etc etc
  </div>
 </article></div>
 <div><article>
 <div class=topic-avatar></div>
  <div class=topic-meta-data>
    // avatar, post time, wiki marker
  </div>
  <div class=cooked> ... </div>
  <!-- First thing we want to collapse -->
  <section class=post-menu-area> ... like, bookmark, reply ... </section>
  <div class=post-links-container>
   <ul> .. internal backlinks to other topics ..
  </ul></div>
 </article></div>
</section>
6 Likes

That’s not really correct, Discourse is a flat discussion system. You can expand replies but it’s a bonus, nice-to-have, optional interaction, not a primary interaction. The expected and typical way to read a topic is straight down, seeing all replies in chronological order.

If I press F12 in my browser, topic replies all look like this:

<div class="topic-post clearfix regular"><article id="post_6" data-post-id="364499" data-user-id="26120" class="boxed onscreen-post">
<div class="topic-post clearfix regular"><article id="post_7" data-post-id="364553" data-user-id="28717" class="boxed onscreen-post">

That’s two post replies, repeat over and over for more, etc.

3 Likes