L. David Baron (Google), dbaron@chromium.org
Written March 28, 2025
A presentation for w3c/csswg-drafts#12019.
Let's look at the appearance:base design principles.
The following design principles apply to the design of the basic appearance stylesheet for form controls, in order of descending importance:
The styles are identical in every user agent.
The controls are recognizable and usable on their own without additional styles.
The controls pass 100% of WCAG 2.2 AA standards.
The styles are consistent across controls…
…in look & feel.
…in how they are defined in code.
…in sizing and interaction.
The styles are easily adapted to the website’s branding, without needing complex reset stylesheets:
They use minimal code and are easy to override.
They do not have a strong voice & tone of their own, and are visually as simple as possible.
They inherit page styles rather than define new styles whenever possible.
They are resilient to adjustments…
…when changed themselves (e.g. changing font, border, layout).
…when put in context (e.g. ready to be flex or grid children).
They are comprehensive:
Covering all states for each control.
Supporting all writing modes and color schemes.
For HTML form controls specifically, these principles are applied through the required user agent stylesheet defined in Appendix A: Basic Appearance User Agent Stylesheet.
<input type=button> <input type=button value="Start"> <input type=button value="Start" style="font-size: 10px">
The following design principles apply to the design of the basic appearance stylesheet for form controls, in order of descending importance:
The styles are identical in every user agent.
The controls are recognizable and usable on their own without additional styles.
The controls pass 100% of WCAG 2.2 AA standards.
The styles are consistent across controls…
…in look & feel.
…in how they are defined in code.
…in sizing and interaction.
The styles are easily adapted to the website’s branding, without needing complex reset stylesheets:
They use minimal code and are easy to override.
They do not have a strong voice & tone of their own, and are visually as simple as possible.
They inherit page styles rather than define new styles whenever possible.
They are resilient to adjustments…
…when changed themselves (e.g. changing font, border, layout).
…when put in context (e.g. ready to be flex or grid children).
They are comprehensive:
Covering all states for each control.
Supporting all writing modes and color schemes.
For HTML form controls specifically, these principles are applied through the required user agent stylesheet defined in Appendix A: Basic Appearance User Agent Stylesheet.
See Success Criterion 2.5.8 Target Size (Minimum).
(Level AA)
New
The size of the target for pointer inputs is at least 24 by 24 CSS pixels, except when:
Ok, let's give it a minimum size (as the stylesheet does today):
button { min-block-size: max(24px, 1lh); min-inline-size: 24px; }
This seems to fix our current problem.
But let's go look at our principles again.
The following design principles apply to the design of the basic appearance stylesheet for form controls, in order of descending importance:
The styles are identical in every user agent.
The controls are recognizable and usable on their own without additional styles.
The controls pass 100% of WCAG 2.2 AA standards.
The styles are consistent across controls…
…in look & feel.
…in how they are defined in code.
…in sizing and interaction.
The styles are easily adapted to the website’s branding, without needing complex reset stylesheets:
They use minimal code and are easy to override.
They do not have a strong voice & tone of their own, and are visually as simple as possible.
They inherit page styles rather than define new styles whenever possible.
They are resilient to adjustments…
…when changed themselves (e.g. changing font, border, layout).
…when put in context (e.g. ready to be flex or grid children).
They are comprehensive:
Covering all states for each control.
Supporting all writing modes and color schemes.
For HTML form controls specifically, these principles are applied through the required user agent stylesheet defined in Appendix A: Basic Appearance User Agent Stylesheet.
Consider this:
<style> .container { display: inline-flex; width: 15em; } input[type=button] { align-self: center; } </style> <div class="container"> <input type="button" value="Start"> <p>This is a larger chunk of text that fills most of the flexbox.</p> </div>
With our old styles, we had this:
This is a larger chunk of text that fills most of the flexbox.
But with our old styles that have a min-inline-size, we have this:
This is a larger chunk of text that fills most of the flexbox.
How do we fix this?
We could make the input into a grid that has 2 different pieces of content in the same grid cell, both of which provide an intrinsic size, so that we have intrinsic sizes coming from two different sources (and we take the larger of them).
But this is really complicated, and makes it very difficult for authors to override these sizes since they need to understand the complex internal structure in order to do so.
The following design principles apply to the design of the basic appearance stylesheet for form controls, in order of descending importance:
The styles are identical in every user agent.
The controls are recognizable and usable on their own without additional styles.
The controls pass 100% of WCAG 2.2 AA standards.
The styles are consistent across controls…
…in look & feel.
…in how they are defined in code.
…in sizing and interaction.
The styles are easily adapted to the website’s branding, without needing complex reset stylesheets:
They use minimal code and are easy to override.
They do not have a strong voice & tone of their own, and are visually as simple as possible.
They inherit page styles rather than define new styles whenever possible.
They are resilient to adjustments…
…when changed themselves (e.g. changing font, border, layout).
…when put in context (e.g. ready to be flex or grid children).
They are comprehensive:
Covering all states for each control.
Supporting all writing modes and color schemes.
For HTML form controls specifically, these principles are applied through the required user agent stylesheet defined in Appendix A: Basic Appearance User Agent Stylesheet.
Can we do better?
Maybe we can if we use calc-size()
(which is only shipped in one engine):
button { min-block-size: calc-size(auto, max(24px, 1lh, size)); min-inline-size: calc-size(auto, max(24px, size)); }
Now we meet WCAG AA sizing requirements and we behave well inside of flexbox or grid.
Are we done? We're still stretching at least some of the principles (though not as badly as with the grid approach). And we're depending on a feature that's only shipped so far in one implementation. Is that okay?
The following design principles apply to the design of the basic appearance stylesheet for form controls, in order of descending importance:
The styles are identical in every user agent.
The controls are recognizable and usable on their own without additional styles.
The controls pass 100% of WCAG 2.2 AA standards.
The styles are consistent across controls…
…in look & feel.
…in how they are defined in code.
…in sizing and interaction.
The styles are easily adapted to the website’s branding, without needing complex reset stylesheets:
They use minimal code and are easy to override.
They do not have a strong voice & tone of their own, and are visually as simple as possible.
They inherit page styles rather than define new styles whenever possible.
They are resilient to adjustments…
…when changed themselves (e.g. changing font, border, layout).
…when put in context (e.g. ready to be flex or grid children).
They are comprehensive:
Covering all states for each control.
Supporting all writing modes and color schemes.
For HTML form controls specifically, these principles are applied through the required user agent stylesheet defined in Appendix A: Basic Appearance User Agent Stylesheet.
I think this may be the best approach, but I'm not sure that the current ordering of the principles agrees.