whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.04k stars 2.63k forks source link

Tightening language around presentation of `<select>` #4675

Open jugglinmike opened 5 years ago

jugglinmike commented 5 years ago

The rendering guidelines for <select> elements has this to say about its "labels":

User agents are expected to render the labels in a select in such a manner that any alignment remains consistent whether the label is being displayed as part of the page or in a menu control.

This is somewhat limited, likely because the widget's default appearance is informed by the platform, so not all rendering details can be specified. However, there are some properties which seem uncontroversial to specify, and doing so may meaningfully improve consistency between and within browsers.

For instance, the effect of text-transform varies greatly when applied to <select>, <optgroup>, and <option> elements:

<select style="text-transform: uppercase;">:

OS browser drop-down, inactive <option> drop-down, active <optgroup> drop-down, active <option> list, <optgroup> list, <option>
macOS chrome UPPER UPPER UPPER UPPER UPPER
macOS firefox UPPER none none UPPER UPPER
macOS safari UPPER UPPER UPPER UPPER UPPER
windows chrome UPPER UPPER UPPER UPPER UPPER
windows firefox UPPER none none UPPER UPPER

<optgroup style="text-transform: uppercase;">:

OS browser drop-down, inactive <option> drop-down, active <optgroup> drop-down, active <option> list, <optgroup> list, <option>
macOS chrome none none none UPPER UPPER
macOS firefox none none none UPPER UPPER
macOS safari none none none none none
windows chrome none UPPER UPPER UPPER UPPER
windows firefox none none none UPPER UPPER

<option style="text-transform: uppercase;">:

OS browser drop-down, inactive <option> drop-down, active <optgroup> drop-down, active <option> list, <optgroup> list, <option>
macOS chrome none none none none UPPER
macOS firefox none none none none UPPER
macOS safari none none none none none
windows chrome none none UPPER none UPPER
windows firefox none none none none UPPER

Setting -webkit-appearance: none does not influence any of these results.

Would the editors accept additional language to standardize this attribute? Are there any others which seem appropriate to nail down?

jugglinmike commented 5 years ago

I've learned via discussion in IRC that the effect of styling <optgroup> and <option> elements is currently undefined. Although there is interest in nailing that down, we won't be able to make progress on this particular issue until that's done.

It might be appropriate to close this issue, though keeping it open could help to communicate intent and host additional discussion. I'll leave the decision to the editors.

annevk commented 5 years ago

We should keep this open as it's part of defining the rendering model (or explicit lack thereof) of these elements.

cc @zcorpan