Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[selectors-4] Replace :user-valid/:user-invalid definition with HTML spec #9308

Closed
wants to merge 6 commits into from

Conversation

josepharhar
Copy link
Contributor

Fixes #9257

As suggested here, this definition is not up to par with the HTML definition and should be replaced by it: #9257 (comment)

Copy link
Collaborator

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure editorially what'd be the best way to do this but the intention of the change looks good. @fantasai / @tabatkins could you take a look?

</form>
</pre>
</div>
The '':user-valid'' and '':user-invalid'' pseudo-classes are defined in HTML here: https://html.spec.whatwg.org/#selector-user-valid
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd probably do <a href="https://html.spec.whatwg.org/#selector-user-valid">in HTML</a>. or so (or using some bikeshed magic to get that), rather than dropping the raw URL there.

@tabatkins or @fantasai should look at this as editors, but lgtm for the general change, we shouldn't have two incompatible definitions of these.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect we'll want language like "are defined by the host language" along with a vague description of what the selectors are about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I brought back the summary paragraph and said that its defined by the host language instead of html

selectors-4/Overview.bs Outdated Show resolved Hide resolved
Copy link
Member

@tabatkins tabatkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped a suggestion, and think we should restore the example, but after that r+

selectors-4/Overview.bs Outdated Show resolved Hide resolved
selectors-4/Overview.bs Show resolved Hide resolved
@josepharhar
Copy link
Contributor Author

@tabatkins can we merge this?

@fantasai
Copy link
Collaborator

I think this approach doesn't do a good job of keeping a baseline definition for host languages that don't define their own rules. Let me see if I can come up with a sort of halfway step here...

@josepharhar
Copy link
Contributor Author

Let me see if I can come up with a sort of halfway step here...

Happy to take any suggestions or a new PR

@dbaron
Copy link
Member

dbaron commented Aug 13, 2024

So I think the existing definition that this is removing is a bit of a mess: it seems to talk about relationships between some of the other pseudo-classes (:invalid, :out-of-range, :required) that should perhaps be defined in the sections for those pseudo-classes but probably shouldn't be defined here.

I think the essence of these pseudo-classes is that they are subsets of :valid and :invalid that only match following certain user interactions that should call attention to the validity/invalidity, such as the user interacting with the control or the user attempting to submit the form. HTML mandates both of these; the text in CSS mandated only the second (submission) but not the first (interaction). The text in CSS also mandated a behavior that the HTML spec doesn't have, which is that they stop matching when the user interacts with the control again.

So I think perhaps the key things to add back to address @fantasai's concern are:

  • making the parallel with :valid and :invalid more explicit again (but hopefully dropping the muddled bit about the other pseudos)
  • explicitly mentioning submitting the form as a type of (or alternative to) significant user interaction with the control

Hopefully we're ok with dropping the bit about no longer matching when the user returns to the control, given that HTML doesn't say that. (Or do any engines implement that?)

@josepharhar
Copy link
Contributor Author

Hopefully we're ok with dropping the bit about no longer matching when the user returns to the control, given that HTML doesn't say that. (Or do any engines implement that?)

Yeah I don't think this is a thing. I think that the only case we start matching these and then stop matching them is when the form is reset.

other pseudo-classes (:invalid, :out-of-range, :required) that should perhaps be defined in the sections for those pseudo-classes but probably shouldn't be defined here.

making the parallel with :valid and :invalid more explicit again (but hopefully dropping the muddled bit about the other pseudos)

Ok, I added a paragraph to the :valid and :invalid sections. How does it look?

explicitly mentioning submitting the form as a type of (or alternative to) significant user interaction with the control

I added a paragraph for this. How does it look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[selectors-4] Should :user-valid and :user-invalid apply to form and fieldset elements?
6 participants