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

33695 radio button constraint validation #33925

Merged
merged 3 commits into from
Jun 6, 2024
Merged

33695 radio button constraint validation #33925

merged 3 commits into from
Jun 6, 2024

Conversation

estelle
Copy link
Member

@estelle estelle commented Jun 4, 2024

fixes #33695 33695

@estelle estelle requested a review from a team as a code owner June 4, 2024 22:29
@estelle estelle requested review from chrisdavidmills and removed request for a team June 4, 2024 22:29
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs size/xs [PR only] 0-5 LoC changed labels Jun 4, 2024
Copy link
Contributor

github-actions bot commented Jun 4, 2024

Preview URLs

(comment last updated: 2024-06-06 08:39:48)

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

Some thoughts

@@ -182,7 +182,7 @@ Beyond accessibility, this is another good reason to properly set up `<label>` e

## Validation

Radio buttons don't participate in constraint validation; they have no real value to be constrained.
While radio buttons have no real value to be constrained, if any radio button in a same-name group of radio buttons has the `required` attribute set, and none of the radio buttons is checked, the [`valueMissing`](/en-US/docs/Web/API/ValidityState/valueMissing) property of a {{domxref("ValidityState")}} object will return true during validation.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds a little over-complicated to me. For example, any radio button with required set will trigger the specified validation, not just ones in a group, and the description of the validation will probably sound a bit confusing to some, without any context of what that is in real terms (i.e. the browser telling you that you need to select an option).

How about something like this:

Suggested change
While radio buttons have no real value to be constrained, if any radio button in a same-name group of radio buttons has the `required` attribute set, and none of the radio buttons is checked, the [`valueMissing`](/en-US/docs/Web/API/ValidityState/valueMissing) property of a {{domxref("ValidityState")}} object will return true during validation.
While radio buttons have no real value to be constrained, they can be set as required. Any radio button with the [`required`](/en-US/docs/Web/HTML/Attributes/required) attribute set (either directly, or via another radio button in a same-name group) will trigger the browser's in-built validation if no option is selected when form submission is attempted. The browser will ask the user to select an option. This is equivalent to the [`valueMissing`](/en-US/docs/Web/API/ValidityState/valueMissing) property of a {{domxref("ValidityState")}} object returning true during validation.

Hrm, still seems a bit wordy. Let me know if that helps at all.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is not the equivalent of valueMissing; it is ValueMissing . i'll rework it to include a single required.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, OK, so it is actually what required uses under the hood! Cool, I didn't know that.

@@ -182,7 +182,7 @@ Beyond accessibility, this is another good reason to properly set up `<label>` e

## Validation

Radio buttons don't participate in constraint validation; they have no real value to be constrained.
While radio buttons have no real value to be constrained, if any radio button in a same-name group of radio buttons has the `required` attribute set, and none of the radio buttons is checked, the [`valueMissing`](/en-US/docs/Web/API/ValidityState/valueMissing) property of a {{domxref("ValidityState")}} object will return true during validation.
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
While radio buttons have no real value to be constrained, if any radio button in a same-name group of radio buttons has the `required` attribute set, and none of the radio buttons is checked, the [`valueMissing`](/en-US/docs/Web/API/ValidityState/valueMissing) property of a {{domxref("ValidityState")}} object will return true during validation.
If a radio button is required or a same-named group or radio buttons has at least one member with `required` set, and no radio buttons is checked, the [`valueMissing`](/en-US/docs/Web/API/ValidityState/valueMissing) property of a {{domxref("ValidityState")}} object will return true during validation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Another suggestion for you:

In the case of a radio button with the required attribute set or a same-named group of radio buttons in which at least one member has required set, a radio button needs to be selected for the control to be considered valid. If no radio button is checked, the valueMissing property of a {{domxref("ValidityState")}} object will return true during validation, and the browser will ask the user to select an option.

I think your new suggestion is improved, but it has a couple of grammar issues, and I still feel like it could do with some description of the actual outcome in the browser.

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

I had another suggestion for you. I'll approve this time so you can put this one to bed.

@@ -182,7 +182,7 @@ Beyond accessibility, this is another good reason to properly set up `<label>` e

## Validation

Radio buttons don't participate in constraint validation; they have no real value to be constrained.
While radio buttons have no real value to be constrained, if any radio button in a same-name group of radio buttons has the `required` attribute set, and none of the radio buttons is checked, the [`valueMissing`](/en-US/docs/Web/API/ValidityState/valueMissing) property of a {{domxref("ValidityState")}} object will return true during validation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Another suggestion for you:

In the case of a radio button with the required attribute set or a same-named group of radio buttons in which at least one member has required set, a radio button needs to be selected for the control to be considered valid. If no radio button is checked, the valueMissing property of a {{domxref("ValidityState")}} object will return true during validation, and the browser will ask the user to select an option.

I think your new suggestion is improved, but it has a couple of grammar issues, and I still feel like it could do with some description of the actual outcome in the browser.

@estelle estelle merged commit 84ae0b4 into main Jun 6, 2024
9 checks passed
@estelle estelle deleted the estelle-patch-14 branch June 6, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTML Hypertext Markup Language docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect validation description
2 participants