If implemented, the API would allow for the Windows Emoji picker in Google Docs, for example. It could also let images relocate on the page depending on layout constraints and better support software keyboards.
Microsoft has built a sample application to show how developers could use EditContext in a simple text editor. However, the solution currently breaks in-built browser spellchecking. This could be an issue for solutions that don't use a custom spellchecker, like Google Docs. You can read the full list of interactions here.
If developers choose to implement the API, they'd get access to the following features:
- “The coordinates of the selection and of a logically editable element so that UI relating to text input can be appropriately positioned.
- Contextual text nearby the selection enabling suggestions for input methods that support generating them.
- The location (expressed as offsets into the contextual text) of selection to enable text input to be inserted at the right location.
- The inputMode to specialize software keyboard layouts.
- The EnterKeyHint to specialize the display of the Enter key on software keyboards.
- The inputPolicy to control whether a software keyboard should automatically appear or needs to be requested explicitly by the user.
- More than one EditContext to convey the information listed above for multiple editable regions of a web application.
- An ability to specify which of those multiple EditContexts is currently the target of text input.
- Text and selection update events; these represent requests for the web app to update their text and selection model given some text input from the user.
- Composition start and end events.
- Text formatting requests that indicate where activity relating to text input, e.g. composition, is taking place.”
The enhanced virtual keyboard support is particularly important as it enables virtual swipe typing and handwriting recognition. The API should also improve accessibility by better supporting tools like a magnifier.
Generally, EditContext lets dev decouple text input from the HTML DOM view, which is why some browser features that rely on DOM may not function correctly. It's already started to integrate the API for use by Chromium Edge and Google Chrome, but it's up to developers to decide whether they want to implement it.