Re: [css-flexbox] Textarea as a flex container

On 10/12/2015 09:26 PM, John Waterson wrote:
> Looking for some guidance from the flexbox spec authors as to whether
> the textarea element should, at least in theory, be able to act as a
> flex container.
>
> It certainly doesn't seem to work in practice (not in Chrome, Firefox
> or Safari on Yosemite anyway). It's possible that this is by design,
> but I can't see anything in the spec that suggests this.
>
> Have I missed something in the spec? Or is this an implementation
> issue, which would then put textarea into the same category as the
> button and fieldset elements, which are already documented (in the
> flexbugs Github repo) as being unable to act as flex-containers.
>
> I have already raised this question on flexbugs, and was advised to
> ask on www-style for clarification, on the reasonable grounds that
> textarea is a bit odd as a container, in that it usually only contains
> text nodes. This is entirely true, but nonetheless, I don't see
> anything in the spec that says plain text content is exempt from
> flexbox layout.
>
> There is a short discussion plus some more detail and a full example
> on the Github issue, if needed. See here:
> https://github.com/philipwalton/flexbugs/issues/85
>
> Many thanks in advance for any guidance you can provide.

Basically, what Boris said is correct wrt styling the textarea,
and therefore treating them as a flex container is unlikely to
work.

However, from your example, it seems all you really want to do
is center the text. The Box Alignment spec is planning to expand
the align-content property to apply to all elements, not just
flex containers, so once that's implemented you will not need
textareas to become flex containers to center their content.
   http://www.w3.org/TR/css-align-3/
Of course, the UAs will still have to make sure that align-self
also does apply to <textarea> -- but it won't require changing
the display model, which is a much trickier proposition for a
form control.

~fantasai

Received on Wednesday, 2 December 2015 00:55:43 UTC