[whatwg] Styling form controls (Was: Re: Forms-related feedback)

Ian Hickson ian at hixie.ch
Tue Dec 3 20:40:09 PST 2013

On Tue, 3 Dec 2013, Jonas Sicking wrote:
> On Tue, Dec 3, 2013 at 11:38 AM, Ian Hickson <ian at hixie.ch> wrote:
> >> The real fix is to allow styling formcontrols. It's one of the most 
> >> requested features from web developers, yet no one has taken the time 
> >> to research what it would take to do it.
> >
> > Isn't that what Web Components is for?
> Not at all.

Well then we'd better create something that _is_ for this.

> However the Shadow DOM spec gets us closer to one approach to it. It 
> lets you replace the rendering of an element with something more complex 
> than what CSS can describe.
> But there's still no spec that enables you to "turn off" the native 
> rendering of a form control and just use the normal CSS+Shadow DOM specs 
> to define the rendering.

With XBL2, that was relatively straight-forward: you just used the 
'binding' property, and the binding's shadow tree replaced the element's 
rendering. Why is it not the same with the Shadom DOM spec?

(Also, isn't the Shadow DOM spec part of "Web Components"?)

Anyway, if we don't yet have a good story here, we should write one. It 
is, as others have pointed out, long overdue.

> Additionally, replacing the rendering rather than styling it is hostile 
> towards new platforms. If everyone had used Shadow-DOM to build their 
> own rendering for <select>s that would have made the transition to 
> mobile much more painful since you'd get a tiny custom <select> UIs 
> rather than a more platform-appropriate picker.

Well, there's not much that can be done about that, as far as I can tell.

> And then there's of course the separate-but-related issue of being able 
> to style scrollbars, which is another reason websites create sea-of-divs 
> pages today. The reason this is related is that the challenges styling 
> form controls isn't really related to form controls, but rather related 
> to styling of UA-provided UI. Scrollbars is another such UI.

Right. We never developed this very far, but with XBL2 the idea was that 
we'd eventually let you override the binding of a '::scrollbox' pseudo, or 
some such.

> So no. I think we are still very far from stylable form controls. And 
> it's hurting the web a whole lot.

I agree it's hurting the Web. I tried to fix this with XBL2, but that 
never went anywhere. Let's not forget this key use case in the Web 
components work that is replacing XBL2.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list