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

Correct explanation of why readonly only affects text controls #27408

Open
aaronadamsCA opened this issue Jun 19, 2023 · 4 comments
Open

Correct explanation of why readonly only affects text controls #27408

aaronadamsCA opened this issue Jun 19, 2023 · 4 comments
Labels
Content:HTML Hypertext Markup Language docs needs info Needs more information to review or act on.

Comments

@aaronadamsCA
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly

What specific section or headline is this issue about?

Overview

What information was incorrect, unhelpful, or incomplete?

Note: Only text controls can be made read-only, since for other controls (such as checkboxes and buttons) there is no useful distinction between being read-only and being disabled, so the readonly attribute does not apply.

What did you expect to see?

Something more like this:

It's important to understand that READONLY merely prevents the user from changing the value of the field, not from interacting with the field. For many types of fields, READONLY is irrelevent because you don't normally change the value. In checkboxes, for example, you can check them on or off (thus setting the CHECKED state) but you don't change the value of the field. DISABLED, however, actually prevents you from using the field.

Source: http://www.faqs.org/docs/htmltut/forms/_INPUT_DISABLED.html

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@aaronadamsCA aaronadamsCA added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jun 19, 2023
@github-actions github-actions bot added the Content:HTML Hypertext Markup Language docs label Jun 19, 2023
@Josh-Cena
Copy link
Member

This note is directly copied from the HTML standard, so I'll take it as more technically accurate than a website from the 2000s. Is there anything fundamentally incompatible between their content?

@Josh-Cena Josh-Cena added needs info Needs more information to review or act on. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jun 26, 2023
@aaronadamsCA
Copy link
Author

I think the readonly spec might be wrong, actually? It says "when specified, the element is not mutable." It defines mutability as "whether or not the user can modify the value or checkedness of a form control." But readonly does not affect the user's ability to modify checkedness.

I think it would be more correct if both the HTML spec and the MDN doc clearly stated that readonly controls whether or not the user can change the value of a text control.

And then I think a more helpful clarification in the MDN doc would be that the readonly attribute is only useful on text controls because it only prevents the user from modifying value, not checkedness; and that as a result, a user can still effectively change the submitted value of a readonly radio button or checkbox control by changing its checkedness.

I hope that makes sense.

@Josh-Cena
Copy link
Member

Could you also send an issue to the HTML spec and see what they think? I'm okay to include more information but I don't want MDN and HTML to be different.

@aaronadamsCA
Copy link
Author

Good idea, I just filed whatwg/html#9496 to see what they say. Thanks!

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 needs info Needs more information to review or act on.
2 participants