I'm sure you've come across the age-old, opinion-based debate of 'Tabs vs. Spaces' for indentation before. It has been going since forever, and there seem to be valid reasons for both sides:
- smaller files because it's just 1 character
- that's what they're used for
- you can customize your own indentation width (👈 keep this one in mind)
- to avoid problems in whitespace-sensitive environments
- because you know what you'll get, and consistency is key
But, there's more to this than just personal preferences. u/ChaseMoskal recently posted a very insightful and eye-opening post on Reddit with the title "Nobody talks about the real reason to use Tabs over Spaces".
In his post, Chase explains his own experience of using spaces at his workplace, and the negative effects it had on co-workers with visual impairment.
One of his co-workers uses a tab-width of
1, to avoid huge indentations when using a large font-size.
Another co-worked of his is using a tab-width of
8 because that works best for his situation with a wide monitor.
I see people saying "tabs lets us customize our tab-width", as though we do this "for fun" — Chase
By using tabs in our projects, we allow these kinds of customizations that are essential for people with visual impairment. Custom tab-widths might seem like an unnecessary thing to most, but some people rely on it—and we can not ignore that.
We simply can't "convert" everyone to one side or the other, there's no question about it. Everyone has their own preferences, and we should celebrate that freedom—that we have the ability to make our own choices.
But with that said, we should also make sure to include everyone, and that means respecting and using accessible tools like the Tab-character.
Much like designing for 'mobile first'—making sure everyone, no matter what device, has a great experience with your product—we should create an 'accessible first' environment, by making sure that everyone has the same ability to work, whether it's at the workplace or on an open-source project.
I thought Chase put it perfectly when he said in his post that "...there's just no counter-argument that even comes close to outweighing the accessibility needs of valued coworkers".
By defaulting to tabs, we make sure that everyone has a great experience working together with others, no matter their own abilities.
And if you prefer spaces, feel free to use an auto-formatting tool that converts tabs to spaces when opening a file (all modern editors have these). Just make sure that the spaces get converted back to tabs before anyone else has to work on your code.
Only by making sure everyone has the same capability can we maximize our combined potential ❤️
I have myself decided to switch to tabs indefinitely after learning about this, but I'd love to hear your thoughts on this as well. Feel free to start a discussion below!
Thank you so much for reading. I hope you all have an amazing weekend. 🤗
This post was originally published on my website at alexandersandberg.com.
Oh, and btw, I just created a listing with a very interesting (and for me, lifechanging) opportunity. It would mean the world to me if you shared my tweet about it. ☺️
Alexander Sandberg@alexandbergI just posted a listing on @DEVListings! 👀
"Looking for company to work with on Master's thesis project in Front-end, UX, and/or Accessibility"
This will be a huuuge next step in my career and life. I would be forever grateful if anyone shared this. ❤️22:17 PM - 11 Jul 2019