Post

Btw Adam if you're running into styling issues using optgroup it's almost definitely a bug. We specifically allowed legend as the first child of optgroup so you could do rich content in it.

So I think the styling story is using legend because then you can select it in CSS, I think just the label attribute on optgroup does remain less styleable. Though including it is better for older (and non chromium) browsers.

demos updated: - fieldset -> optgroup with label for better fallback + match desired semantics

0 reposts4 likes

Niiice! Fwiw, you can avoid the text repetition by using attr(label) to save the text to a custom property, then use CSS content on a pseudo to output it.