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] 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