Tabs or Spaces: Considering Indentation from an Accessibility Perspective
In development, whether to use spaces or tabs for indentation can be considered an eternal debate.
I recently attempted to change indentation to spaces in Change indentation from tabs to spaces · Issue #214 · giselles-ai/giselle.
However, after discovering the article Default to tabs instead of spaces for an ‘accessible first’ environment · Alexander Sandberg, I reconsidered my position.
This article explains why tabs should be the default from an accessibility perspective.
First, let me briefly summarize the benefits of tabs and spaces.
While spaces have their merits as shown above, tabs are overwhelmingly superior from an accessibility standpoint.
In Alexander Sandberg’s article, he cites a Reddit post discussing the importance of tabs. Some developers with visual impairments set their tab width to 1 to prevent indentation from becoming too large with bigger font sizes, while others set tab width to 8 to match their monitor environment. This way, using tabs allows for flexible customization of indent width according to each person’s environment.
Just as we have the concept of “mobile-first,” we should also consider “accessible-first” in development environments. In other words, it’s important to create an environment where everyone can develop equally. Using tabs is one important element for achieving this.
As stated in the article:
“there’s just no counter-argument that even comes close to outweighing the accessibility needs of valued coworkers”
This statement says it all.
By using tabs, indent width can be flexibly adjusted according to individual environments, allowing more people to participate comfortably in development.
Related article: GitHubのコードのタブインデントの表示を調整する方法
This issue attempting to change indentation to spaces became a good opportunity to reconsider the importance of tabs from an accessibility perspective.
I hope to continue developing with accessibility in mind, aiming for an environment where all developers can work comfortably.
That’s all from the Gemba, where we’ve considered indentation and accessibility.