Tabs Over Spaces: The Accessibility Perspective

Note

Message thread

Matthias Zöchling wrote on

I’m on Team Tabs, but I’ve always said to each their own. Not anymore! Having just learned that not using tabs is an #a11y issue makes spaces no longer justifiable.

The main reason [for tabs instead of spaces] is for refreshable braille displays that are used by blind programmers a lot. Each space wastes one braille cell and takes away valuable braille realestate. So if the default indentation of a project is 4 spaces per level, a 3rd level indentation wastes 12 braille cells before code starts. On a 40 cell display, which is the most commonly used with notebooks, this is more than a quarter of the available cells wasted with no information. If each indentation level was represented by only one tab character, there would be three cells occupied by a tab character each, and on the 4th cell, the code would start. That’s less than 10 percent occupied on the same length display, but all cells contain valuable information that is easily discoverable and immediately comprehensible.

h/t Rich Harris via Juan Olvera.

Matthias Zöchling wrote on

Great to see someone with the reach of @DasSurma spreading the word. 💜

“Be the change you want to see in the world.”

I will now switch all my personal JS projects to using tabs for indentation.

Coincidentally, I turned my “tabs over spaces” journey into a series yesterday. This series is not open-ended, as the #a11y part closes the case.

Join the conversation

Have your say on Twitter/X.