From 60fde748da525662fbc8eef4ba9fd242a33a6a57 Mon Sep 17 00:00:00 2001 From: Ryo Matsukawa <76232929+ryo-manba@users.noreply.github.com> Date: Mon, 4 Dec 2023 21:32:33 +0900 Subject: [PATCH] Update autocapitalize props (#30734) * Update autocapitalize props * Apply suggestions from code review * Update autocapitalize attribute documentation for mobile browser compatibility * Update textarea and input documentation for autocapitalize attribute * fix attribute types * fix: link * Tweaks to text * Tweaks to * Couple more tweaks * Small tweak * Tweak * Fix note boxes * Test * Remove test --------- Co-authored-by: Chris Mills Co-authored-by: Jean-Yves Perrier --- files/en-us/web/html/element/form/index.md | 22 ++++++++--- files/en-us/web/html/element/input/index.md | 37 +++++++++---------- .../en-us/web/html/element/textarea/index.md | 19 +++++++++- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/files/en-us/web/html/element/form/index.md b/files/en-us/web/html/element/form/index.md index fbd1cec2cf7a531..74de684188c2546 100644 --- a/files/en-us/web/html/element/form/index.md +++ b/files/en-us/web/html/element/form/index.md @@ -24,16 +24,26 @@ This element includes the [global attributes](/en-US/docs/Web/HTML/Global_attrib > **Note:** **This attribute has been deprecated and should not be used.** Instead, use the [`accept`](/en-US/docs/Web/HTML/Element/input#accept) attribute on `` elements. - `accept-charset` + - : Space-separated {{Glossary("character encoding", "character encodings")}} the server accepts. The browser uses them in the order in which they are listed. The default value means [the same encoding as the page](/en-US/docs/Web/HTTP/Headers/Content-Encoding). (In previous versions of HTML, character encodings could also be delimited by commas.) -- `autocapitalize` {{non-standard_inline}} - - : A nonstandard attribute used by iOS Safari that controls how textual form elements should be automatically capitalized. `autocapitalize` attributes on a form elements override it on ``. Possible values: +- `autocapitalize` + + - : Controls whether text entered into the form is automatically capitalized on mobile browsers and, if so, in what manner. The possible values are: + + - `none` or `off` + - : Do not automatically capitalize any text. + - `sentences` or `on` + - : Automatically capitalize the first character of each sentence. + - `words` + - : Automatically capitalize the first character of each word. + - `characters` + - : Automatically capitalize every character. + + > **Note:** When `autocapitalize` is set on a ``, it controls the autocapitalization behavior of all contained {{htmlelement("input")}} (except `url`, `email`, and `password` types) and {{htmlelement("textarea")}} elements, overriding any `autocapitalize` values set on contained elements. - - `none`: No automatic capitalization. - - `sentences` (default): Capitalize the first letter of each sentence. - - `words`: Capitalize the first letter of each word. - - `characters`: Capitalize all characters — that is, uppercase. + > **Note:** Where `autocapitalize` is not specified, the adopted default behavior varies between browsers. Chrome (Android) and Safari (iOS) default to `on`/`sentences`, while Firefox (Android) defaults to `off`/`none`. - `autocomplete` diff --git a/files/en-us/web/html/element/input/index.md b/files/en-us/web/html/element/input/index.md index ee74f125456d102..61599feabdc03df 100644 --- a/files/en-us/web/html/element/input/index.md +++ b/files/en-us/web/html/element/input/index.md @@ -321,6 +321,7 @@ Attributes for the `` element include the [global HTML attributes](/en-US | --------------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | [`accept`](#accept) | `file` | Hint for expected file type in file upload controls | | [`alt`](#alt) | `image` | alt attribute for the image type. Required for accessibility | +| [`autocapitalize`](#autocapitalize) | all except `url`, `email`, and `password` | Controls text capitalization in mobile browsers. | | [`autocomplete`](#autocomplete) | all except `checkbox`, `radio`, and buttons | Hint for form autofill feature | | [`capture`](#capture) | `file` | Media capture input method in file upload controls | | [`checked`](#checked) | `checkbox`, `radio` | Whether the command or control is checked | @@ -365,6 +366,23 @@ A few additional non-standard attributes are listed following the descriptions o - : Valid for the `image` button only, the `alt` attribute provides alternative text for the image, displaying the value of the attribute if the image [`src`](#src) is missing or otherwise fails to load. See the {{HTMLElement("input/image", "image")}} input type. +- `autocapitalize` + + - : Controls whether text entered into input fields is automatically capitalized on mobile browsers and, if so, in what manner. This attribute does not affect the `url`, `email`, or `password` input types, where autocapitalization is never enabled. The possible values are: + + - `none` or `off` + - : Do not automatically capitalize any text. + - `sentences` or `on` + - : Automatically capitalize the first character of each sentence. + - `words` + - : Automatically capitalize the first character of each word. + - `characters` + - : Automatically capitalize every character. + + > **Note:** `autocapitalize` can be set on `` and {{htmlelement("textarea")}} elements, and on their containing {{htmlelement("form")}} elements. When `autocapitalize` is set on a `` element, it sets the autocapitalize behavior for all contained inputs (except `url`, `email`, and `password` types) and ``s, overriding any `autocapitalize` values set on contained elements. + + > **Note:** Where `autocapitalize` is not specified, the adopted default behavior varies between browsers. Chrome (Android) and Safari (iOS) default to `on`/`sentences`, while Firefox (Android) defaults to `off`/`none`. + - [`autocomplete`](/en-US/docs/Web/HTML/Attributes/autocomplete) - : (**Not** a Boolean attribute!) The [`autocomplete`](/en-US/docs/Web/HTML/Attributes/autocomplete) attribute takes as its value a space-separated string that describes what, if any, type of autocomplete functionality the input should provide. A typical implementation of autocomplete recalls previous values entered in the same input field, but more complex forms of autocomplete can exist. For instance, a browser could integrate with a device's contacts list to autocomplete `email` addresses in an email input field. See [`autocomplete`](/en-US/docs/Web/HTML/Attributes/autocomplete#values) for permitted values. @@ -625,12 +643,6 @@ The following non-standard attributes are also available on some browsers. As a - - autocapitalize - - A string indicating how auto-capitalization should be applied to the content of text elements. Safari only. - - autocorrect @@ -677,19 +689,6 @@ The following non-standard attributes are also available on some browsers. As a -- `autocapitalize` {{non-standard_inline}} - - - : (Safari only). A string which indicates how auto-capitalization should be applied while the user is editing this field. Permitted values are: - - - `none` or `off` - - : Do not automatically capitalize any text - - `sentences` or `on` - - : Automatically capitalize the first character of each sentence. - - `words` - - : Automatically capitalize the first character of each word. - - `characters` - - : Automatically capitalize every character. - - `autocorrect` {{non-standard_inline}} - : (Safari only). A string which indicates whether to activate automatic correction while the user is editing this field. Permitted values are: diff --git a/files/en-us/web/html/element/textarea/index.md b/files/en-us/web/html/element/textarea/index.md index b68c55f182bf5a2..c6174ff349658e2 100644 --- a/files/en-us/web/html/element/textarea/index.md +++ b/files/en-us/web/html/element/textarea/index.md @@ -18,12 +18,29 @@ The above example demonstrates a number of features of ``: - `rows` and `cols` attributes to allow you to specify an exact size for the `` to take. Setting these is a good idea for consistency, as browser defaults can differ. - Default content entered between the opening and closing tags. `` does not support the `value` attribute. -The `` element also accepts several attributes common to form ``s, such as `autocomplete`, `autofocus`, `disabled`, `placeholder`, `readonly`, and `required`. +The `` element also accepts several attributes common to form ``s, such as `autocapitalize`, `autocomplete`, `autofocus`, `disabled`, `placeholder`, `readonly`, and `required`. ## Attributes This element includes the [global attributes](/en-US/docs/Web/HTML/Global_attributes). +- `autocapitalize` + + - : Controls whether text entered into ``s is automatically capitalized on mobile browsers and, if so, in what manner. The possible values are: + + - `none` or `off` + - : Do not automatically capitalize any text. + - `sentences` or `on` + - : Automatically capitalize the first character of each sentence. + - `words` + - : Automatically capitalize the first character of each word. + - `characters` + - : Automatically capitalize every character. + + > **Note:** `autocapitalize` can be set on `` and {{htmlelement("input")}} elements, and on their containing {{htmlelement("form")}} elements. When `autocapitalize` is set on a `` element, it sets the autocapitalize behavior for all contained ``s and inputs (except `url`, `email`, and `password` types), overriding any `autocapitalize` values set on contained elements. + + > **Note:** Where `autocapitalize` is not specified, the adopted default behavior varies between browsers. Chrome (Android) and Safari (iOS) default to `on`/`sentences`, while Firefox (Android) defaults to `off`/`none`. + - `autocomplete` - : This attribute indicates whether the value of the control can be automatically completed by the browser. Possible values are:
autocapitalize
autocorrect