Skip to content

Commit

Permalink
Add user agent styles for form controls
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Feb 11, 2021
1 parent 698981e commit f15c6a5
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Items that are related, such as breaking changes, new features, or changes to ex

- [@siteimprove/alfa-aria](packages/alfa-aria): `Node.from()` now correctly handles children of elements with roles that designate their children as presentational.

- [@siteimprove/alfa-cascade](packages/alfa-cascade): The user agent styles now include previously missing definitions for form controls.

## [0.10.0](../../compare/v0.9.0...v0.10.0) (2021-01-29)

### Breaking
Expand Down
46 changes: 46 additions & 0 deletions packages/alfa-cascade/src/user-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,52 @@ export const UserAgent = h.sheet([
display: "none !important",
}),

/**
* @see https://html.spec.whatwg.org/#form-controls
*/

h.rule.style("input, select, button, textarea", {
letterSpacing: "initial",
wordSpacing: "initial",
lineHeight: "initial",
textTransform: "initial",
textIndent: "initial",
textShadow: "initial",
}),

h.rule.style("input, select, textarea", {
textAlign: "initial",
}),

h.rule.style(
"input:is([type=reset i], [type=button i], [type=submit i]), button",
{
textAlign: "center",
}
),

h.rule.style(
"input:is([type=reset i], [type=button i], [type=submit i], [type=color i]), button",
{
display: "inline-block",
}
),

h.rule.style(
"input:is([type=radio i], [type=checkbox i], [type=reset i], [type=button i], [type=submit i], [type=color i], [type=search i]), select, button",
{
boxSizing: "border-box",
}
),

h.rule.style("textarea", { whiteSpace: "pre-wrap" }),

// <button> element defaults applied consistently by browsers.
h.rule.style("button", {
fontStyle: "normal",
fontWeight: "400",
}),

/**
* @see https://html.spec.whatwg.org/#the-hr-element-rendering
*/
Expand Down

0 comments on commit f15c6a5

Please sign in to comment.