sindresorhus / modern-normalize

🐒 Normalize browsers' default style

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix `tab-size`

sindresorhus opened this issue · comments

I would like to change the tab-size from 8 to 4. I realize it's not strictly a normalization, as all browsers use 8, but it would improve the experience for everyone, so I think it's worth an exception. 8 is just a really really bad default. It has, for example, made tab-indented code on the web unreadable (isaacs/github#170).

I propose adding the following:

:root {
	-moz-tab-size: 4;
	tab-size: 4;
}

Using :root so users can easily override it on a per-element basis.

Thoughts?

(If you 👎 please also share your thoughts on why)

Normalize to me is more of a pre-defaults project. I think sane defaults, like box-sizing and such, should be in a different project. My reasoning for this is, I may need older browser support in my normalization, but still want sane defaults, I wouldn't want to import two normalize.css projects.

@simonlc And I agree in general, this project is for normalization, but I've already argued above that this specific case would be a nice exception. It shouldn't cause any problems. Only huge benefits.

I may need older browser support in my normalization

This project doesn't support older browsers.

I support the "not supporting old browsers" approach 👍
That is the only way to progress..

As a side note, I asked on the CSSWG tracker if tab-size could be changed to a default of 4, and it’s not likely because it might break some specific websites that use ASCII art with mixed tabs and spaces.

If you’re a base CSS lib and not a browser though, tab-size: 4 makes a lot of sense.

it might break some specific websites that use ASCII art with mixed tabs and spaces.

Oddly enough, most[*] text editors set tab size to 4 so the web is actually already breaking ASCII art 😆

[*]: I realize that "most" is a strong word but most I have used. Maybe most modern IDEs.

It’s a good idea for solve xojs/xo#45 (comment).

I really like this. But isn't it possible to add this only to code, kbd, samp and pre?

@jerolimov I don't really see the benefit of narrowing it down. Tabs can be used outside those tags too.