per-coding-style
per-coding-style copied to clipboard
Using tabs for accessibility
Has switching to tabs instead of spaces been considered for accessibility reasons? This tweet has been making the rounds recently: https://twitter.com/Rich_Harris/status/1541761871585464323
Kirby CMS recently made the switch too: https://github.com/getkirby/kirby/pull/4454
There's no plan to break backwards compatibility with existing PSR-12 for now.
I'd like to keep this issue open since the accessibility aspect of indentation hasn't been fully discussed.
The backwards compatibility break this would cause would likely force maintainers to change 90% of the lines in their codebases causing git blame to be polluted. So with that in mind we will continue to recommend spaces over tabs while encouraging people to do what Kirby is doing and say something like "We are Coding Style PER compliant with the following changes:" for the foreseeable future.
I will also note that there is a fair number of anecdotal statements about tabs being better for accessibility, but I am not aware of any actual research or verification of that claim. For PHP to switch, there would need to be clear, research-based evidence that it notably improves accessibility. A tweet of a GitHub comment does not achieve that standard.
https://www.reddit.com/r/javascript/comments/c8drjo/comment/eszeclz/ is an interesting discussion.
@KorvinSzanto All this you talk about could (and should) have been forecasted while psr-12 was being planned; now is too late = two things:
psr-12is so widely used,- it would halt development of many projects for months if not years.
To put this simply: its well known fact that tabs are more welomed than spaces. Not to mention that TABS are far less error-prone than spaces
Spaces instead of tabs goes back to PSR-2, not PSR-12. PSR-2 had a lot of problems, most notably that decisions were made based purely on a naive survey rather than considering what made consistent sense. At the time, though, WordPress was basically the only project in PHP that used tabs. Everyone used spaces. And at the time, no one was talking about one being better for accessibility, and all "less error prone" and "more welcomed" claims (either direction) are and have always been entirely circumstantial and subjective with no data to back them up.
Seriously, until and unless there's some actual academic research on this topic any words spent on it are a total waste of time.
@Crell sure thing. I just voiced what my experience is. I have been using tabs for as long as I can remember, it suits me best, am OK with it.
It doesnt change the fact that, if necesity arises, I will not change my habit of using tabs nor am I open to debate whivh one is better and why.
What I struggle to understand is the need to forcing usage of one thing over the other upon users (developers):: let everyone use what they feel using;
Thats also why Im sceptic about whole PSR thing: I mean: you want to have standard way of doing things throughout php? Great, but: lets force noone into using it. Lets not make sth like: "apps in php that do adhere to no psr have no right to exist".
Lets treat psr more as Good Practices, less as enforced Standard.