mdn / sprints

Archived: MDN Web Docs issues are tracked in the content repository.
https://github.com/mdn/content
Creative Commons Zero v1.0 Universal
149 stars 142 forks source link

Incorrect description for the radio input checked attribute #3875

Closed zbrogz closed 3 years ago

zbrogz commented 3 years ago

Request type

Details

The description for the radio input checked attribute is slightly off: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio#checked

Currently it says (emphasis added):

A Boolean attribute which, if present, indicates that this radio button is the currently selected one in the group.

Per the HTML spec, it should instead say something like this:

A Boolean attribute which, if present, indicates that this radio button is the default selected one in the group.

MendyBerger commented 3 years ago

Setting 'checked' programmatically (e.g. with setAttribute) will set the checkbox to checked, so maybe the word "default" isn't the most descriptive either

zbrogz commented 3 years ago

The spec is a little wonky in my opinion, so I'm not totally sure what the description should be. I do think "default" or "initially" would be less confusing than "currently", however.

Note that the checked attribute and checked property are not always in sync (element.getAttribute('checked') vs element.checked). In other words, the checked attribute does not always reflect the currently selected radio.

Edit:

This is the wording in the spec:

The checked content attribute is a boolean attribute that gives the default checkedness of the input element.

MendyBerger commented 3 years ago

Sorry, my bad, disregard my comment. The fact that setting it programmatically checks the checkbox, is perfectly compatible with the term "default".

I've fixed it in the docs https://wiki.developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio$revision/1653437

chrisdavidmills commented 3 years ago

Perfect fix, thanks a lot @MendyBerger !