6
\$\begingroup\$

Recently I noticed this edit. Here is an example section:

using a single mathematical operation is 4*(min(d4, 3)) - 8, or in anydice terms 4d{1,2,3,3} - 8 (or equivalently 4d{-1,0,1,1}

was edited to:

using a single mathematical operation is 4*(min(d4, 3)) - 8, or in anydice terms 4d{1,2,3,3} - 8 (or equivalently 4d{-1,0,1,1})

KorvinStarmast's rationale for the edit was:

Nice answer, but in the future please don't use code blocks. They mess up a lot of screen readers. I replaced yours with italics.

Another example:

(4d6k3 - 10) / 2

edited to:

(4d6k3 - 10) / 2

I'd like to discuss where the line is (even if fuzzy) for the use of code tags for dice syntax.

Previous discussions

I am not personally too familiar with screen readers, but I did find a couple previous discussions:

Inline Code Spans should not be used for emphasis, right?

SevenSidedDie:

Code formatting is semantic HTML to indicate to a parser that text is code. If we start lying to our parsers, we break tools built on HTML. Consider screen readers: if a visually impaired user configures their software to spell out code tags, or to have an easy keyboard shortcut with a macro called "jump to next code span/block and highlight" for easy copy-pasting, we are significantly disabling their ability to interact with the page. Further disabling, I should say.

How do I write an accessible Stack Exchange post?

Regarding italics:

Mithical:

According to the style guide for dyslexia, it looks like italics in general can make it harder to read, but it doesn't specifically point out stacking bold and italics. It advises using bold for emphasis but to avoid italics.

wizzwizz4:

@Mithical That advice might be good for dyslexia, but it's not generally applicable; bold also has problems. We can't do one-size-fits-all, so I tend to fall back to the HTML semantics, where <strong> is for importance, <b> is for catching the eye, <em> is for stress-emphasis in prose, <mark> is for (emphasis mine), and <i> is for most other stuff. In the distant future where computers actually work properly, you'll be able to configure your browser to map HTML's semantics to a presentation that works for your brain.

On screen readers:

wizzwizz4 again:

Btw I remember reading a complaint on mSO that <code> triggered some screen readers to spell the contents out (like CSS speak-as: spell-out, instead of the more sensible literal-punctuation). Your bad alt text examples are clearer when presented in monospace (at least, to me), but they don't have code semantics. Considering you can't use CSS or aria attributes, I don't know what the right solution here is.

Laurel:

@wizzwizz4 "code triggered some screen readers to spell the contents out"—Correct, but I would expect most users to use the middle ground settings. For me, source code is spoken the same as regular text except all punctuation is spoken too, so it will pronounce words as words, not spell them out. If I did need something spelled out, I could switch to "character" mode instead of using "container" mode. (Maybe I should write a guide explaining how a person uses a screen reader?) Anyway, I think monospaced is appropriate for the examples, which are markdown code

Is there a functional purpose to putting things in code text here?

Top answer by SevenSidedDie:

Code formatting should never be used for non-code markup.

(Feel free to edit with any additional relevant prior discussions.)

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Just want to follow up and say "good job asking this question on Meta" since it clears up something insofar as the specific case in your question that I raised the issue of code blocks on. Well done. 👍 \$\endgroup\$ Commented Jun 5 at 13:46

1 Answer 1

10
\$\begingroup\$

Code tags if the dice syntax refers to a specific computerized system; normal text otherwise

Since AnyDice syntax can be copy-pasted into a specific computerized system, I would say that code tags are appropriate. Pronouncing the punctuation seems usually acceptable to preferable here?

Legend of the Five Rings is a specific system (well, a couple specific systems if we count edition changes), but it is not primarily a computerized system. Therefore I would render "6k3" without code tags in that context.

Given the questionable status of italics, I would prefer normal text for generic dice syntax (e.g. 3d6). The presence of numbers in dice syntax hopefully provides visual distinction without being distracting. For more complex expressions, LaTeX is more readable. It appears that many screen readers are capable of handling MathJax (ref 1, ref 2), which is how LaTeX is rendered on StackExchange, though NVDA requires an extension to do so.

Examples from OP

using a single mathematical operation is \$4 \times \left(\min\left(\text{d4}, 3\right)\right) - 8\$, or in anydice terms 4d{1,2,3,3} - 8 (or equivalently 4d{-1,0,1,1})

In this case, since AnyDice is mentioned explicitly, and the expression uses AnyDice-specific syntax for defining custom dice, I'm inclined to use code tags for the second and third expressions. I would be inclined to use code tags even if AnyDice was only strongly implied.

Given the "mathematical" context, LaTeX works well for the first expression.

(4d6k3 - 10) / 2

Several virtual tabletops (e.g. Roll20, Foundry, Fantasy Grounds) do recognize this "k" syntax as used here. However, their dice languages as a whole do not share the same syntax (or semantics) in all cases. In other words, this "k" syntax is arguably computerized, but not specific. Therefore, absent a reference to a specific virtual tabletop, I would use normal text.

\$\endgroup\$
3
  • 4
    \$\begingroup\$ IMO, "4*(min(d4, 3)) - 8" does need either code tags or (a rewrite in) LaTeX, both because it's semantically not normal body text and because it's barely readable using the default body text font and formatting (and probably makes no sense if read out like normal body text by a screen reader, either). Whether it should be 4*(min(d4, 3)) - 8 of \$4 \times (\min({\rm d}4, 3)) - 8\$ is arguable, and ultimately comes down to whether the writer intended it as pseudocode or as a mathematical formula. \$\endgroup\$ Commented May 27 at 21:12
  • \$\begingroup\$ Good point, and it does look like many screen readers support MathJax. I'll modify my recommendation. \$\endgroup\$ Commented May 28 at 9:34
  • 2
    \$\begingroup\$ @HighDiceRoller Notably, NVDA—a very popular, free screenreader for Windows—does not support MathJax at all (or at least did not, there may have been an update since I last checked). I seem to recall there are some plugins you might get for it to get poor support, but most aren’t going to have that. \$\endgroup\$
    – KRyan
    Commented May 30 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .