Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tab-size-spacing-* rely on generic monospace font to be defaulted at 13px #48840

Open
kostyafarber opened this issue Oct 28, 2024 · 0 comments
Open
Labels

Comments

@kostyafarber
Copy link

kostyafarber commented Oct 28, 2024

These tests assume that the default font-size on the generic monospace property of font-family is 13px. It is indeed 13px on Chrome and Firefox etc but this isn't part of any spec I can find, for instance in the suggested default css https://www.w3.org/TR/CSS21/sample.html. It is also configurable by the user which means it shouldn't be relied upon as a value for testing.

To illustrate, when tab size is a number, it depends on the advance width of the space character https://drafts.csswg.org/css-text/#tab-size-property, if a browser chooses to have monospaced fonts default to 16px this will result in the green box overshooting the red box in https://wpt.live/css/css-text/tab-size/tab-size-spacing-001.html.

A possible solution is to set the font-size explicitly.

For context, this came about whilst implementing tab-size in the Ladybird browser, in which monospaced fonts are defaulted to 16px. Forcing 13px would pass the aforementioned test.

I'm not sure if this affects other tests that make this assumption that would have implications that could lead to inconsistent results across browsers that choose to make monospaced default values different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants