WebKit / standards-positions

WebKit's positions on emerging web specifications
https://webkit.org/standards-positions/
254 stars 23 forks source link

Request for Position: EditContext #243

Open dandclark opened 1 year ago

dandclark commented 1 year ago

WebKittens

@annevk

Title of the spec

EditContext API

URL to the spec

https://w3c.github.io/edit-context/

URL to the spec's repository

https://github.com/w3c/edit-context

Issue Tracker URL

No response

Explainer URL

https://github.com/w3c/edit-context/blob/gh-pages/explainer.md

TAG Design Review URL

https://github.com/w3ctag/design-reviews/issues/416

Mozilla standards-positions issue URL

https://github.com/mozilla/standards-positions/issues/199

WebKit Bugzilla URL

No response

Radar URL

No response

Description

The EditContext API simplifies the process of integrating a web app with advanced text input methods like IME compositions, handwriting panels, and speech recognition.

Today the web platform provides out-of-the-box editing experiences for single lines of plain-text (input), small amounts of multi-line plain-text (textarea) and a starting point for building an HTML document editing experience (contenteditable elements). Each of these editable elements come built-in editing behaviors that are often inadequate to power the desired editing experience. As a result, web-based editors don't incorporate the web platform's editable elements into their view. Unfortunately, the only API provided by the web platform today to enable advanced text input experiences is to place an editable element in the DOM and focus it.

This contradiction of needing an editable element, but not wanting it to be visible, leads web-based editors to create hidden editable elements to facilitate text input. This approach negatively impacts accessibility and increases complexity, leading to buggy behavior.

An alternative is to incorporate a contenteditable element into the view of the editor, regardless of whether the editor is editing an HTML document. This approach limits the editor's flexibilty in modifying the view, since the view is also powering the text input experience.

EditContext addresses these problems by decoupling text input from the HTML DOM view. Rather than having the web platform infer the data required to enable sophisticated text input mechanisms from the HTML DOM, the author will provide that data explicitly through the API surface of the EditContext.