Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intent to prototype and ship: :user-valid and :user-invalid pseudo-classes.

233 views
Skip to first unread message

Emilio Cobos Álvarez

unread,
Feb 22, 2021, 8:59:46 AM2/22/21
to Mozilla
Hi,

In bug 1694141 I plan to unprefix :-moz-ui-valid and :-moz-ui-invalid
pseudo-classes. These are useful pseudo-classes to determine when to
show feedback to the user about a form control being invalid.

Standard: https://drafts.csswg.org/selectors/#user-pseudos

Platform coverage: all

Preference: None

Devtools bug: N/A

Other browsers: No signal from other vendors, though we've shipped this
functionality for quite a while and the CSS working group considers it
useful, see discussions:

* https://lists.w3.org/Archives/Public/www-style/2012Aug/0749.html
* https://lists.w3.org/Archives/Public/www-style/2015Sep/0111.html

I'm hoping that unprefixing it in Gecko will serve as a bit of a nag to
other browsers.

Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1156069

WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=222267

web-platform-tests: There's a test for :user-invalid in css/selectors. I
plan to add a test for :user-valid. There's
https://github.com/web-platform-tests/wpt/issues/9346 on file for adding
WPTs that test the user-interaction part of this.

Let me know if you have any objections about this change, but I think
having a prefixed pseudo-class for this is not a great state of affairs.

-- Emilio

Anne van Kesteren

unread,
Feb 23, 2021, 3:25:26 AM2/23/21
to Emilio Cobos Álvarez, Mozilla
On Mon, Feb 22, 2021 at 2:59 PM Emilio Cobos Álvarez <emi...@mozilla.com> wrote:
> Let me know if you have any objections about this change, but I think
> having a prefixed pseudo-class for this is not a great state of affairs.

This seems reasonable, but I think we should define the processing
model for them in the HTML Standard as well, to ensure everyone can
align on when exactly these are supposed to match.

Xidorn Quan

unread,
Feb 23, 2021, 5:52:43 AM2/23/21
to Emilio Cobos Álvarez, john.bieling--- via dev-platform
On Tue, Feb 23, 2021, at 12:59 AM, Emilio Cobos Álvarez wrote:
> Standard: https://drafts.csswg.org/selectors/#user-pseudos
>
> Other browsers: No signal from other vendors, though we've shipped this
> functionality for quite a while and the CSS working group considers it
> useful, see discussions:
>
> * https://lists.w3.org/Archives/Public/www-style/2012Aug/0749.html
> * https://lists.w3.org/Archives/Public/www-style/2015Sep/0111.html
>
> I'm hoping that unprefixing it in Gecko will serve as a bit of a nag to
> other browsers.

Please head up in CSS working group about this, and probably ask for a resolution on no objection for us to ship it, as this spec is still in draft.

- Xidorn

Emilio Cobos Álvarez

unread,
Feb 23, 2021, 6:09:06 AM2/23/21
to Xidorn Quan, Emilio Cobos Álvarez, Mozilla
On 2/23/21 11:52, Xidorn Quan wrote:
> Please head up in CSS working group about this, and probably ask for a resolution on no objection for us to ship it, as this spec is still in draft.

Hmm, is it? https://www.w3.org/TR/selectors-4/#user-pseudos has had
:user-invalid for quite a while, and we and other engines ship a lot of
stuff in selectors-4.

(I just added spec text for :user-valid, but it was noted in the
non-draft spec that there was a resolution to add it as well).

Anyhow not particularly trying to avoid this, just trying to clarify the
situation. A heads-up probably wouldn't hurt anyways, and per Anne's
comments we might want some html spec text as well.

-- Emilio

Emilio Cobos Álvarez

unread,
Feb 23, 2021, 6:11:50 AM2/23/21
to Anne van Kesteren, Mozilla, fantasai
The original spec text for :user-invalid was pretty flexible in terms of
when it can match. My understanding is that that was kind of intentional
(cc'ing fantasai who was part of those discussions).

But yeah I tend to agree we probably want to define more precisely when
these must match and maybe even when they may match.

-- Emilio

Anne van Kesteren

unread,
Feb 24, 2021, 3:33:10 AM2/24/21
to fantasai, Emilio Cobos Álvarez, Mozilla
On Tue, Feb 23, 2021 at 9:49 PM fantasai <fantasa...@inkedblade.net> wrote:
> We wanted it to be flexible enough that UAs could experiment with behavior and
> improve usability over time, so we locked down the one period in time that we
> felt was not up for debate (between attempted submission and next interaction
> with the invalid input) and left the rest open to interpretation.

I played with this some more and I think that might be a tad too
vague. E.g., if you cancel an invalid event Firefox will no longer
show UI messages to the user about filling in a form control, but
:-moz-ui-invalid still matches (see
https://software.hixie.ch/utilities/js/live-dom-viewer/saved/8957 for
a demo). And flexibility here is tough as web developers likely want
these to be fully deterministic to be able to build consistent
experiences.
0 new messages