Skip to content

Commit

Permalink
Add docs for HTMLElement.writingSuggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
skyclouds2001 authored Dec 1, 2024
1 parent 33f1146 commit 5d9a10b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions files/en-us/web/api/htmlelement/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
45 changes: 45 additions & 0 deletions files/en-us/web/api/htmlelement/writingsuggestions/index.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5d9a10b

Please sign in to comment.