@@ -1829,7 +1829,7 @@ Animation type: discrete
18291829 Replaced elements other than form controls are not affected by this,
18301830 and remain replaced elements.
18311831 Form controls are <em> not</em> made to look like native controls of the host operating system.
1832- See below for details.
1832+ See [[#appearance-decorative]] and [[#appearance-semantics]] for details.
18331833
18341834 <dt> <dfn>auto</dfn>
18351835 <dd>
@@ -1872,6 +1872,32 @@ Animation type: discrete
18721872
18731873</dl>
18741874
1875+ <div class=example>
1876+ An author wanting to customize the look and feel of check boxes in HTML could use the following:
1877+ <pre><code class="lang-css">
1878+ input[type=checkbox] {
1879+ all: unset; /* this shorthand includes resetting appearance to none */
1880+ width: 1em;
1881+ height: 1em;
1882+ display: inline-block;
1883+ background: red;
1884+ }
1885+ input[type=checkbox]:checked {
1886+ border-radius: 50%;
1887+ background: green;
1888+ }
1889+ input[type=checkbox]:focus-visible {
1890+ outline: auto;
1891+ }
1892+ </code></pre>
1893+
1894+ <code class="lang-markup"> <input type="checkbox"></code> would be rendered as
1895+ <span style="display: inline-block; width: 1em; height: 1em; background: red;"></span> ,
1896+ while <code class="lang-markup"> <input type="checkbox" checked></code> would be rendered as
1897+ <span style="display: inline-block; width: 1em; height: 1em; background: green; border-radius: 50%;"></span> ,
1898+ and activating (for example by clicking) the element would toggle the state as usual.
1899+ </div>
1900+
18751901On form control elements where the computed value is ''appearance/auto'' or one of the <<compat>> values,
18761902and on any element where the computed value is ''appearance/button'' ,
18771903UAs may disregard some CSS properties
@@ -1904,6 +1930,12 @@ blacklisting those that are not?
19041930Either way, UAs do ignore some properties when rendering form controls,
19051931so this specification needs to say something about this.
19061932
1933+ For compatibility with legacy content, UAs must also support <dfn property export>-webkit-appearance</dfn>
1934+ as a [=legacy name alias=] of 'appearance' .
1935+
1936+ <h4 id=appearance-decorative>
1937+ Effects of 'appearance' on Decorative Aspects of Elements</h4>
1938+
19071939All decorative visual aspects of a form control which are not caused by a CSS style rule
19081940must be suppressed when the appearance is changed using 'appearance' ,
19091941even if the UA's internal representation for this element
@@ -1916,7 +1948,26 @@ was composed of multiple elements or pseudo elements combined together.
19161948 this must disappear.
19171949</div>
19181950
1919- However, the UA must preserve aspects of the form control
1951+ UAs should include in their User Agent stylesheet style rules
1952+ to give form controls a recognizable shape when 'appearance' is ''appearance/none'' .
1953+
1954+ Note: Authors may therefore need to override these UA style rules to get the styling
1955+ they intended.
1956+
1957+ <div class=advisement>
1958+ Authors may find it convenient to use ''all: unset'' ,
1959+ to get fully unstyled form control elements
1960+ which they can then style as they want without interference from the browser's UA stylesheet.
1961+ However, this also suppresses the focus indicators provided by the same UA stylesheet.
1962+ In order avoid damaging accessibility,
1963+ authors who do so should restore a focus indicator,
1964+ for instance by using '':focus-visible { outline: auto; }'' .
1965+ </div>
1966+
1967+ <h4 id=appearance-semantics>
1968+ Effects of 'appearance' on Semantic Aspects of Elements</h4>
1969+
1970+ UAs must preserve aspects of the form control
19201971which are necessary to operate the control with its original semantics.
19211972The UA may however give them a different look and feel
19221973as long as it remains possible to operate the control.
@@ -1942,22 +1993,6 @@ what needs to be preserved.
19421993 which can be styled in different ways using the '':checked'' selector.
19431994</div>
19441995
1945- UAs should include in their User Agent stylesheet style rules
1946- to give form controls a recognizable shape when 'appearance' is ''appearance/none''.
1947-
1948- Note: Authors may therefore need to override these UA style rules to get the styling
1949- they intended.
1950-
1951- <div class=advisement>
1952- Authors may find it convenient to use ''all: unset'',
1953- to get fully unstyled form control elements
1954- which they can then style as they want without interference from the browser's UA stylesheet.
1955- However, this also suppresses the focus indicators provided by the same UA stylesheet.
1956- In order avoid damaging accessibility,
1957- authors who do so should restore a focus indicator,
1958- for instance by using ''focus-visible { outline: auto; }''.
1959- </div>
1960-
19611996The behavior and semantics of elements remain defined by the document language,
19621997and are not influenced by this property.
19631998
@@ -1990,35 +2025,6 @@ that are typical of the element whose appearance it acquires.
19902025 is also not changed by the 'appearance' property.
19912026</div>
19922027
1993- <div class=example>
1994- An author wanting to customize the look and feel of check boxes in HTML could use the following:
1995- <pre><code class="lang-css">
1996- input[type=checkbox] {
1997- all: unset; /* this shorthand includes resetting appearance to none */
1998- width: 1em;
1999- height: 1em;
2000- display: inline-block;
2001- background: red;
2002- }
2003- input[type=checkbox]:checked {
2004- border-radius: 50%;
2005- background: green;
2006- }
2007- input[type=checkbox]:focus-visible {
2008- outline: auto;
2009- }
2010- </code></pre>
2011-
2012- <code class="lang-markup"> <input type="checkbox"></code> would be rendered as
2013- <span style="display: inline-block; width: 1em; height: 1em; background: red;"></span> ,
2014- while <code class="lang-markup"> <input type="checkbox" checked></code> would be rendered as
2015- <span style="display: inline-block; width: 1em; height: 1em; background: green; border-radius: 50%;"></span> ,
2016- and activating (for example by clicking) the element would toggle the state as usual.
2017- </div>
2018-
2019- For compatibility with legacy content, UAs must also support <dfn property export>-webkit-appearance</dfn>
2020- as a [=legacy name alias=] of 'appearance' .
2021-
20222028<h3 id=control-specific-rules>
20232029Form Control Specific Rules</h3>
20242030
0 commit comments