From 5d9a10b360513a22c372c80087bd5901ce8a1673 Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Sun, 1 Dec 2024 11:01:20 +0800 Subject: [PATCH 1/6] Add docs for `HTMLElement.writingSuggestions` --- files/en-us/web/api/htmlelement/index.md | 2 + .../htmlelement/writingsuggestions/index.md | 45 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 files/en-us/web/api/htmlelement/writingsuggestions/index.md diff --git a/files/en-us/web/api/htmlelement/index.md b/files/en-us/web/api/htmlelement/index.md index 23f0cfe6fa5c175..f2a12240e7ef976 100644 --- a/files/en-us/web/api/htmlelement/index.md +++ b/files/en-us/web/api/htmlelement/index.md @@ -86,6 +86,8 @@ _Also inherits properties from its parent, {{DOMxRef("Element")}}._ - : A boolean value representing the translation. - {{DOMxRef("HTMLElement.virtualKeyboardPolicy")}} {{Experimental_Inline}} - : A string indicating the on-screen virtual keyboard behavior on devices such as tablets, mobile phones, or other devices where a hardware keyboard may not be available, if the element's content is editable (for example, it is an {{htmlelement("input")}} or {{htmlelement("textarea")}} element, or an element with the [`contenteditable`](/en-US/docs/Web/HTML/Global_attributes/contenteditable) attribute set). +- {{DOMxRef("HTMLElement.writingSuggestions")}} + - : A string indicating if browser-provided writing suggestions should be enabled on the element or not. ## Instance methods diff --git a/files/en-us/web/api/htmlelement/writingsuggestions/index.md b/files/en-us/web/api/htmlelement/writingsuggestions/index.md new file mode 100644 index 000000000000000..225f4176c7c2fdc --- /dev/null +++ b/files/en-us/web/api/htmlelement/writingsuggestions/index.md @@ -0,0 +1,45 @@ +--- +title: "HTMLElement: writingSuggestions property" +short-title: writingSuggestions +slug: Web/API/HTMLElement/writingSuggestions +page-type: web-api-instance-property +browser-compat: api.HTMLElement.writingSuggestions +--- + +{{APIRef("HTML DOM")}} + +The **`writingSuggestions`** property of the {{domxref("HTMLElement")}} interface is a string indicating if browser-provided writing suggestions should be enabled on the element or not. + +It reflects the value of the [`writingsuggestions`](/en-US/docs/Web/HTML/Global_attributes/writingsuggestions) HTML global attribute. + +## Value + +An enumerated value; possible values are: + +- `"true"` or an empty string (`""`) + - : The browser automatically shows the virtual keyboard when the user taps or focuses the element. +- `"false"` + - : The browser does not automatically show the virtual keyboard: showing/hiding the virtual keyboard is handled manually by the script. + +## Examples + +The following example shows how to disable writing suggestions offered by user agents via script: + +```js +const element = document.querySelector("input"); + +// writing suggestions offered by user agents will be disabled by script manually on this input +element.writingSuggestions = "manual"; +``` + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} + +## See also + +- [`writingsuggestions`](/en-US/docs/Web/HTML/Global_attributes/writingsuggestions) HTML global attribute From 019d84b4c7989a713e24cdd7f0c0436f9f3e6640 Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Sun, 1 Dec 2024 11:08:25 +0800 Subject: [PATCH 2/6] fix desc --- files/en-us/web/api/htmlelement/index.md | 2 +- files/en-us/web/api/htmlelement/writingsuggestions/index.md | 2 +- files/en-us/web/html/global_attributes/index.md | 4 ++-- .../web/html/global_attributes/writingsuggestions/index.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/files/en-us/web/api/htmlelement/index.md b/files/en-us/web/api/htmlelement/index.md index f2a12240e7ef976..18a3dc8edfa4f21 100644 --- a/files/en-us/web/api/htmlelement/index.md +++ b/files/en-us/web/api/htmlelement/index.md @@ -87,7 +87,7 @@ _Also inherits properties from its parent, {{DOMxRef("Element")}}._ - {{DOMxRef("HTMLElement.virtualKeyboardPolicy")}} {{Experimental_Inline}} - : A string indicating the on-screen virtual keyboard behavior on devices such as tablets, mobile phones, or other devices where a hardware keyboard may not be available, if the element's content is editable (for example, it is an {{htmlelement("input")}} or {{htmlelement("textarea")}} element, or an element with the [`contenteditable`](/en-US/docs/Web/HTML/Global_attributes/contenteditable) attribute set). - {{DOMxRef("HTMLElement.writingSuggestions")}} - - : A string indicating if browser-provided writing suggestions should be enabled on the element or not. + - : A string indicating if browser-provided writing suggestions should be enabled under the scope of the element or not. ## Instance methods diff --git a/files/en-us/web/api/htmlelement/writingsuggestions/index.md b/files/en-us/web/api/htmlelement/writingsuggestions/index.md index 225f4176c7c2fdc..e24d8d873ce6054 100644 --- a/files/en-us/web/api/htmlelement/writingsuggestions/index.md +++ b/files/en-us/web/api/htmlelement/writingsuggestions/index.md @@ -8,7 +8,7 @@ browser-compat: api.HTMLElement.writingSuggestions {{APIRef("HTML DOM")}} -The **`writingSuggestions`** property of the {{domxref("HTMLElement")}} interface is a string indicating if browser-provided writing suggestions should be enabled on the element or not. +The **`writingSuggestions`** property of the {{domxref("HTMLElement")}} interface is a string indicating if browser-provided writing suggestions should be enabled under the scope of the element or not. It reflects the value of the [`writingsuggestions`](/en-US/docs/Web/HTML/Global_attributes/writingsuggestions) HTML global attribute. diff --git a/files/en-us/web/html/global_attributes/index.md b/files/en-us/web/html/global_attributes/index.md index c888e68139aa754..c35f10cbcb49717 100644 --- a/files/en-us/web/html/global_attributes/index.md +++ b/files/en-us/web/html/global_attributes/index.md @@ -125,14 +125,14 @@ In addition to the basic HTML global attributes, the following global attributes - [`virtualkeyboardpolicy`](/en-US/docs/Web/HTML/Global_attributes/virtualkeyboardpolicy) {{Experimental_Inline}} - - : An [enumerated](/en-US/docs/Glossary/Enumerated) attribute used to control the on-screen virtual keyboard behavior on devices such as tablets, mobile phones, or other devices where a hardware keyboard may not be available for elements that its content is editable (for example, it is an {{htmlelement("input")}} or {{htmlelement("textarea")}} element, or an element with the [`contenteditable`](/en-US/docs/Web/HTML/Global_attributes/contenteditable) attribute set). + - : An {{Glossary("enumerated")}} attribute used to control the on-screen virtual keyboard behavior on devices such as tablets, mobile phones, or other devices where a hardware keyboard may not be available for elements that its content is editable (for example, it is an {{htmlelement("input")}} or {{htmlelement("textarea")}} element, or an element with the [`contenteditable`](/en-US/docs/Web/HTML/Global_attributes/contenteditable) attribute set). - `auto` or an _empty string_, which automatically shows the virtual keyboard when the element is focused or tapped. - `manual`, which decouples focus and tap on the element from the virtual keyboard's state. - [`writingsuggestions`](/en-US/docs/Web/HTML/Global_attributes/writingsuggestions) - - : Used to control the behavior of the browser's writing suggestions in an input field, a section of a page, or the entire page. + - : An {{Glossary("enumerated")}} attribute indicating if browser-provided writing suggestions should be enabled under the scope of the element or not. - `false`, which disables the browser's writing suggestions. - `true` or an _empty string_, which enables writing suggestions. diff --git a/files/en-us/web/html/global_attributes/writingsuggestions/index.md b/files/en-us/web/html/global_attributes/writingsuggestions/index.md index 8c094f32781f598..bc96e5a5d47be46 100644 --- a/files/en-us/web/html/global_attributes/writingsuggestions/index.md +++ b/files/en-us/web/html/global_attributes/writingsuggestions/index.md @@ -7,7 +7,7 @@ browser-compat: html.global_attributes.writingsuggestions {{HTMLSidebar("Global_attributes")}} -The **`writingsuggestions`** [global attribute](/en-US/docs/Web/HTML/Global_attributes) is an {{glossary("enumerated")}} attribute indicating if browser-provided writing suggestions should be enabled on the element or not. +The **`writingsuggestions`** [global attribute](/en-US/docs/Web/HTML/Global_attributes) is an {{glossary("enumerated")}} attribute indicating if browser-provided writing suggestions should be enabled under the scope of the element or not. Some browsers provide writing suggestions to users as they type in editable fields. Suggestions usually appear as greyed-out text positioned after the text cursor, completing the user's sentence. While this can be helpful to users, developers might want to turn writing suggestions off in some cases, such as when providing site-specific writing suggestions. From 340dcfbe7ce563a84a2a39e67593278d66d0c81b Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Sat, 14 Dec 2024 16:20:35 +0800 Subject: [PATCH 3/6] Update files/en-us/web/api/htmlelement/writingsuggestions/index.md --- files/en-us/web/api/htmlelement/writingsuggestions/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/htmlelement/writingsuggestions/index.md b/files/en-us/web/api/htmlelement/writingsuggestions/index.md index e24d8d873ce6054..978564aae13075a 100644 --- a/files/en-us/web/api/htmlelement/writingsuggestions/index.md +++ b/files/en-us/web/api/htmlelement/writingsuggestions/index.md @@ -29,7 +29,7 @@ The following example shows how to disable writing suggestions offered by user a const element = document.querySelector("input"); // writing suggestions offered by user agents will be disabled by script manually on this input -element.writingSuggestions = "manual"; +element.writingSuggestions = "true"; ``` ## Specifications From 0cda8892a3da947535e8afd910a6ab23b31f5def Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Sat, 14 Dec 2024 16:24:03 +0800 Subject: [PATCH 4/6] Apply suggestions from code review --- files/en-us/web/api/htmlelement/writingsuggestions/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/en-us/web/api/htmlelement/writingsuggestions/index.md b/files/en-us/web/api/htmlelement/writingsuggestions/index.md index 978564aae13075a..c3a05d68f9d2e89 100644 --- a/files/en-us/web/api/htmlelement/writingsuggestions/index.md +++ b/files/en-us/web/api/htmlelement/writingsuggestions/index.md @@ -16,7 +16,7 @@ It reflects the value of the [`writingsuggestions`](/en-US/docs/Web/HTML/Global_ An enumerated value; possible values are: -- `"true"` or an empty string (`""`) +- `"true"` - : The browser automatically shows the virtual keyboard when the user taps or focuses the element. - `"false"` - : The browser does not automatically show the virtual keyboard: showing/hiding the virtual keyboard is handled manually by the script. @@ -29,7 +29,7 @@ The following example shows how to disable writing suggestions offered by user a const element = document.querySelector("input"); // writing suggestions offered by user agents will be disabled by script manually on this input -element.writingSuggestions = "true"; +element.writingSuggestions = "false"; ``` ## Specifications From 0f70aeb3abef11bd5d07acf46de7e123fd84fd2a Mon Sep 17 00:00:00 2001 From: Estelle Weyl Date: Mon, 16 Dec 2024 12:26:22 -0800 Subject: [PATCH 5/6] Update files/en-us/web/api/htmlelement/writingsuggestions/index.md --- files/en-us/web/api/htmlelement/writingsuggestions/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/htmlelement/writingsuggestions/index.md b/files/en-us/web/api/htmlelement/writingsuggestions/index.md index c3a05d68f9d2e89..2ef2698f1032a7b 100644 --- a/files/en-us/web/api/htmlelement/writingsuggestions/index.md +++ b/files/en-us/web/api/htmlelement/writingsuggestions/index.md @@ -28,7 +28,7 @@ The following example shows how to disable writing suggestions offered by user a ```js const element = document.querySelector("input"); -// writing suggestions offered by user agents will be disabled by script manually on this input +// disable user agent writing suggestions offered element.writingSuggestions = "false"; ``` From d83e1d7af0fc1d3d31e84ca9627bef39ffe97099 Mon Sep 17 00:00:00 2001 From: Estelle Weyl Date: Mon, 16 Dec 2024 12:27:02 -0800 Subject: [PATCH 6/6] Update files/en-us/web/api/htmlelement/writingsuggestions/index.md --- files/en-us/web/api/htmlelement/writingsuggestions/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/htmlelement/writingsuggestions/index.md b/files/en-us/web/api/htmlelement/writingsuggestions/index.md index 2ef2698f1032a7b..91f67985ff8874a 100644 --- a/files/en-us/web/api/htmlelement/writingsuggestions/index.md +++ b/files/en-us/web/api/htmlelement/writingsuggestions/index.md @@ -28,7 +28,7 @@ The following example shows how to disable writing suggestions offered by user a ```js const element = document.querySelector("input"); -// disable user agent writing suggestions offered +// disable user agent writing suggestions element.writingSuggestions = "false"; ```