Intent to Implement: EditContext API
Contact emails
sni...@microsoft.com, gl...@microsoft.com, pc...@microsoft.com
Explainer
Design doc
TAG review: https://github.com/w3ctag/design-reviews/issues/416
Summary
The EditContext API simplifies the process of integrating a web app with advanced text input methods (IME), improves accessibility and performance, and unlocks new capabilities for web-based editors.
Motivation
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 the editable elements provided by the web platform comes with 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 flexibility in modifying the view, since the view is also powering the text input experience.
The EditContext addresses the core issue by decoupling text input from the DOM. Rather than having the web platform infer the data required to enable sophisticated text input mechanisms from the DOM, the author will provide that data explicitly through the API surface of the EditContext.
See the explainer for more details.
Risks
Interoperability and Compatibility
Web authors opt-in to using the EditContext. It can co-exist with the existing approaches that leverage contenteditable and textarea and be used instead when feature detected.
There are no known interop or compat risks.
Edge:In development
Chrome: In development
Firefox: No signals
Safari: No signals
Web / Framework developers: Positive support from Google docs, Word online and VS Code teams
Challenges with offscreen contenteditable element usage faced by Google docs.
Ergonomics
N/A
Activation
Most sites will consume the EditContext through editing frameworks and component libraries. Outreach to popular editing frameworks and libraries will be needed for broad adoption.
Debuggability
Existing DevTools should be sufficient to debug EditContext APIs.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes
Link to entry on the feature dashboard
https://chromestatus.com/feature/5041440373604352
Requesting approval to ship?
No
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/38a58c98-c2ef-410e-91ce-97a67d53af28%40chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAJUhtG8BSTkV_yTXhyw8hiob%2BFKc0%2BY2in1MQmcbnykQ2oq%3Dfg%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to blin...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/38a58c98-c2ef-410e-91ce-97a67d53af28%40chromium.org.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blin...@chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/45bcb868-5608-4887-8e37-60336292c167%40chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/45bcb868-5608-4887-8e37-60336292c167%40chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/45bcb868-5608-4887-8e37-60336292c167%40chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/5a4405b5-60ee-4057-8f5d-64e3b6e04e42%40chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/5a4405b5-60ee-4057-8f5d-64e3b6e04e42%40chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/6b01b0f0-3ba0-4117-84b7-cc15c9647f75%40chromium.org.
Is there a reason that you used APIs like focus/blur instead of having an "activeEditContext" variable on the document?It seems that the Document (in its impl) would need to maintain a weak reference to the edit context. Then if the main reference to the EditContext is thrown out how does that work? How does the document know it isn't assigned. Or are you expecting focus() to assign the a strong reference to the EditContext and it would remain for how long?Would it ever be useful to lookup what the current edit context is in a standard way? Perhaps from an embedded library. Or knowing there is an edit context alive?dave.On Thu, Sep 5, 2019 at 10:26 PM 'Anupam Snigdha' via blink-dev <blin...@chromium.org> wrote:@Joe In case its helpful to you I provided some links in the explainer to some animated GIFs demonstrating what I'm referring to wherever I mention advanced text input methods.@Mustaq These are really good questions, thanks for asking!RE Focus and event dispatching: The view doesn't forward the focus in any automatic way... the author needs to call editContext.focus() whenever they want to enable "advanced text input methods". Per the explainer that can be when some editable part of their application's view has been focused, or it could be when some custom widget is focused like in the case of the select type-to-search behavior. So I expect that when some focused element gets its focusin event handler called that it will in turn call editContext.focus() on an appropriate editContext instance to turn on advanced text input methods.Note that one point of confusion is likely the reuse of the word "focus". editContext.focus() doesn't steal focus from the DOM. We've had some conversations internally on whether we should call it something different like activate to avoid this confusion. I don't believe there is any problem with regards to focus ambiguity if I understand your question correctly. The activeElement is unchanged after calling editContext.focus(). Focusing (or activating) an editContext is just a way to tell the OS that the author wants advanced text input methods enabled and that the metadata required for suggestions, where text input UI should appear, what the input mode is, etc. should all come from this particular editContext instance.RE the association with an event loop. To my knowledge there is no requirement to be associated with a DOM node to participate in a window event loop. The focused (or activated) EditContext (if any) associated with window of the active document will receive events from the OS text input services. Probably some examples with multiple EditContexts in different iframes would help clear this up in the explainer.
RE EditContext.inputMode: I think we should make it mutable just like text, selection, and layout bounds properties of the EditContext. There is one caveat to this which also exists in the editable elements: if an EditContext had password inputMode and now changed to text, then we want to make sure we clear the text to avoid suggestions from appearing on VKs that might reveal some password details.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAHgVhZWbVNvzj5goJM9n033wRPrsARFYWA9L2o_9K894zNe7ZA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/6b01b0f0-3ba0-4117-84b7-cc15c9647f75%40chromium.org.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blin...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAHgVhZWbVNvzj5goJM9n033wRPrsARFYWA9L2o_9K894zNe7ZA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/2067e47a-874b-47dc-b365-923f8d6c3b70%40chromium.org.
> To unsubscribe from this group and stop receiving emails from it, send an email to blin...@chromium.org
> <mailto:blin...@chromium.org>.