Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to define how <optgroup>'s label should be rendered. #4093

Open
emilio opened this issue Oct 16, 2018 · 3 comments
Open

Need to define how <optgroup>'s label should be rendered. #4093

emilio opened this issue Oct 16, 2018 · 3 comments

Comments

@emilio
Copy link
Contributor

emilio commented Oct 16, 2018

This is loosely related to #4086. Right now Gecko renders the <optgroup>s label with:

optgroup::before {
  display: block;
  content: attr(label);
}

I think that's not a great way to do it, but we need to come up with another way of rendering it. Blink / WebKit use Shadow DOM, which means that as a side effect, this works:

<optgroup label="The label" style="display: contents"></optgroup>

But it's not clear to me why it should, and if we want to make that work our only feasible alternative to our current ::before implementation is Shadow DOM.

In any case, it has to be defined how UAs should render the label, or maybe at least be added to the set of special elements in css-display where display: contents computes to none:

https://drafts.csswg.org/css-display/#unbox-html

@annevk
Copy link
Member

annevk commented Oct 16, 2018

cc @zcorpan

@zcorpan
Copy link
Member

zcorpan commented Oct 16, 2018

Right now the spec says

An optgroup element is expected to be rendered by displaying the element's label attribute.

A quick test case

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/6286

In Firefox the label on the multiline select is "adsfasdfaf", but in the dropdown it is "xxx" (but the width of the single-line select is affected by the author-CSS generated content).

Safari ignores the generated content in both cases.

Chrome and Edge show the generated content and the label in the multiline select, and ignores it in the dropdown.

@MatsPalmgren @tkent-google @FremyCompany any opinions?

@tkent-google
Copy link
Contributor

I'd like to assume <option> and <optgroup> just provide the owner <select> with data, they don't create CSS boxes, and they don't support almost all CSS styling including generated contents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants