Testing the appearance:base design principles

L. David Baron (Google), dbaron@chromium.org

Written March 28, 2025

A presentation for w3c/csswg-drafts#12019.

Design principles

Let's look at the appearance:base design principles.

2.1. Design Principles for the Basic Appearance

The following design principles apply to the design of the basic appearance stylesheet for form controls, in order of descending importance:

  1. The styles are identical in every user agent.

  2. The controls are recognizable and usable on their own without additional styles.

  3. The controls pass 100% of WCAG 2.2 AA standards.

  4. The styles are consistent across controls…

    1. …in look & feel.

    2. …in how they are defined in code.

    3. …in sizing and interaction.

  5. The styles are easily adapted to the website’s branding, without needing complex reset stylesheets:

    1. They use minimal code and are easy to override.

    2. They do not have a strong voice & tone of their own, and are visually as simple as possible.

    3. They inherit page styles rather than define new styles whenever possible.

    4. They are resilient to adjustments…

      1. …when changed themselves (e.g. changing font, border, layout).

      2. …when put in context (e.g. ready to be flex or grid children).

  6. They are comprehensive:

    1. Covering all states for each control.

    2. 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.

What if we have nothing to control the size of the button?

<input type=button>
<input type=button value="Start">
<input type=button value="Start" style="font-size: 10px">
Start Start

2.1. Design Principles for the Basic Appearance

The following design principles apply to the design of the basic appearance stylesheet for form controls, in order of descending importance:

  1. The styles are identical in every user agent.

  2. The controls are recognizable and usable on their own without additional styles.

  3. The controls pass 100% of WCAG 2.2 AA standards.

  4. The styles are consistent across controls…

    1. …in look & feel.

    2. …in how they are defined in code.

    3. …in sizing and interaction.

  5. The styles are easily adapted to the website’s branding, without needing complex reset stylesheets:

    1. They use minimal code and are easy to override.

    2. They do not have a strong voice & tone of their own, and are visually as simple as possible.

    3. They inherit page styles rather than define new styles whenever possible.

    4. They are resilient to adjustments…

      1. …when changed themselves (e.g. changing font, border, layout).

      2. …when put in context (e.g. ready to be flex or grid children).

  6. They are comprehensive:

    1. Covering all states for each control.

    2. 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).

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:

Spacing
Undersized targets (those less than 24 by 24 CSS pixels) are positioned so that if a 24 CSS pixel diameter circle is centered on the bounding box of each, the circles do not intersect another target or the circle for another undersized target;
Equivalent
The function can be achieved through a different control on the same page that meets this criterion;
Inline
The target is in a sentence or its size is otherwise constrained by the line-height of non-target text;
User Agent Control
The size of the target is determined by the user agent and is not modified by the author;
Essential
A particular presentation of the target is essential or is legally required for the information being conveyed.

Let's try a minimum size

Ok, let's give it a minimum size (as the stylesheet does today):

button {
  min-block-size: max(24px, 1lh);
  min-inline-size: 24px;
}
Start Start

This seems to fix our current problem.

Do our principles say this is good?

But let's go look at our principles again.

2.1. Design Principles for the Basic Appearance

The following design principles apply to the design of the basic appearance stylesheet for form controls, in order of descending importance:

  1. The styles are identical in every user agent.

  2. The controls are recognizable and usable on their own without additional styles.

  3. The controls pass 100% of WCAG 2.2 AA standards.

  4. The styles are consistent across controls…

    1. …in look & feel.

    2. …in how they are defined in code.

    3. …in sizing and interaction.

  5. The styles are easily adapted to the website’s branding, without needing complex reset stylesheets:

    1. They use minimal code and are easy to override.

    2. They do not have a strong voice & tone of their own, and are visually as simple as possible.

    3. They inherit page styles rather than define new styles whenever possible.

    4. They are resilient to adjustments…

      1. …when changed themselves (e.g. changing font, border, layout).

      2. …when put in context (e.g. ready to be flex or grid children).

  6. They are comprehensive:

    1. Covering all states for each control.

    2. 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:

Start

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:

Start

This is a larger chunk of text that fills most of the flexbox.

Can we do better inside of flex and grid? (attempt 1)

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.

2.1. Design Principles for the Basic Appearance

The following design principles apply to the design of the basic appearance stylesheet for form controls, in order of descending importance:

  1. The styles are identical in every user agent.

  2. The controls are recognizable and usable on their own without additional styles.

  3. The controls pass 100% of WCAG 2.2 AA standards.

  4. The styles are consistent across controls…

    1. …in look & feel.

    2. …in how they are defined in code.

    3. …in sizing and interaction.

  5. The styles are easily adapted to the website’s branding, without needing complex reset stylesheets:

    1. They use minimal code and are easy to override.

    2. They do not have a strong voice & tone of their own, and are visually as simple as possible.

    3. They inherit page styles rather than define new styles whenever possible.

    4. They are resilient to adjustments…

      1. …when changed themselves (e.g. changing font, border, layout).

      2. …when put in context (e.g. ready to be flex or grid children).

  6. They are comprehensive:

    1. Covering all states for each control.

    2. 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 inside of flex and grid? (attempt 2)

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?

2.1. Design Principles for the Basic Appearance

The following design principles apply to the design of the basic appearance stylesheet for form controls, in order of descending importance:

  1. The styles are identical in every user agent.

  2. The controls are recognizable and usable on their own without additional styles.

  3. The controls pass 100% of WCAG 2.2 AA standards.

  4. The styles are consistent across controls…

    1. …in look & feel.

    2. …in how they are defined in code.

    3. …in sizing and interaction.

  5. The styles are easily adapted to the website’s branding, without needing complex reset stylesheets:

    1. They use minimal code and are easy to override.

    2. They do not have a strong voice & tone of their own, and are visually as simple as possible.

    3. They inherit page styles rather than define new styles whenever possible.

    4. They are resilient to adjustments…

      1. …when changed themselves (e.g. changing font, border, layout).

      2. …when put in context (e.g. ready to be flex or grid children).

  6. They are comprehensive:

    1. Covering all states for each control.

    2. 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.