Re: [csswg-drafts] [selectors] decide on :blank (#1967)

I need some clarification on this. 

So if `:blank` is being dropped completely, is `:empty` being updated to also cover `<input>` and `<textarea>` elements that have no text in them?

If yes, does white space count as content in these form elements?
I agree completely that for regular HTML elements `:empty` should not count white space as content. For form elements though I think it should count.

The primary use case for supporting `:empty` on form elements is for supporting the floating label design pattern.

```html
<label>
    <input/>
    <span>label text</span>
</label>
```

```css
input:focus + span,
input:empty + span {
    /* styles that move the label out of the input area */
}
```

When the input is empty and doesn't have focus, the label looks like placeholder text. When it has focus, or has content, the label moves out of the way.

I think it is useful for users if, for form elements, `:empty` counts white space as content. That way, if the user has entered spaces and no text, and the user has removed focus from the field, the label still displays in label form rather than placeholder form.

The advantage to the user here is that the field looks empty but since the label is displaying differently, the user is able to recognise that there is some white space content in there. If this matters for form submission then it is better for the user to be aware of what fields have only white space in them. Having white space only form submissions probably isn't that big of a deal though so having `:empty` not count white space in form elements isn't that bad.

-- 
GitHub Notification of comment by Dan503
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1967#issuecomment-519254211 using your GitHub account

Received on Wednesday, 7 August 2019 20:21:33 UTC