<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>269922</bug_id>
          
          <creation_ts>2024-02-22 07:46:16 -0800</creation_ts>
          <short_desc>Add API to programatically manipulate text composition (EditContext)</short_desc>
          <delta_ts>2026-04-09 01:06:28 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>HTML Editing</component>
          <version>Safari 17</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>dcordoneanu</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>apolostudioapps</cc>
    
    <cc>ap</cc>
    
    <cc>fantasai.bugs</cc>
    
    <cc>megan_gardner</cc>
    
    <cc>rniwa</cc>
    
    <cc>vitor.roriz</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
    
    <cc>woodlxf00</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2016085</commentid>
    <comment_count>0</comment_count>
    <who name="">dcordoneanu</who>
    <bug_when>2024-02-22 07:46:16 -0800</bug_when>
    <thetext>Right now, in Safari, on both MacOS and iOS, trying to end a composition state or manipulate it is impossible. 

In our specific scenario, we have a hidden textarea which is focused when the user needs to add some text and has the selection synced programatically based on user action. However, for CJK scenarios, it is impossible to achieve the same behaviour as the textarea has when it is manipulated directly by the user.

I think it would be highly beneficial for different scenarios to be able to have an API that allows a developer to programatically:
- change the composition range
- manipulate undetermined and determined text
- decide when a composition should end 

I&apos;ve also tried some different approaches to end a composition as it can be seen in the following fiddles:

https://jsfiddle.net/6h93zkf4/1/

https://jsfiddle.net/6h93zkf4/2/

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2017758</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-02-29 07:47:41 -0800</bug_when>
    <thetext>&lt;rdar://problem/123834175&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2017883</commentid>
    <comment_count>2</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2024-02-29 15:29:22 -0800</bug_when>
    <thetext>Sounds like this is an ask for EditContext.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2019286</commentid>
    <comment_count>3</comment_count>
    <who name="">dcordoneanu</who>
    <bug_when>2024-03-07 00:31:28 -0800</bug_when>
    <thetext>Hello,

Indeed it could be linked to the EditContext. Is there a status on your side regarding the implementation of the EditContext API for MacOS/iOS?

Thank you!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2194784</commentid>
    <comment_count>4</comment_count>
    <who name="Apolo">apolostudioapps</who>
    <bug_when>2026-03-28 16:53:39 -0700</bug_when>
    <thetext>Is EditContext going to be worked on by the WebKit team anytime soon?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195129</commentid>
    <comment_count>5</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2026-03-30 05:29:18 -0700</bug_when>
    <thetext>(In reply to Apolo from comment #4)
&gt; Is EditContext going to be worked on by the WebKit team anytime soon?

There is no an active plan as far as I know. I don&apos;t think we have major concerns about the design so it&apos;s likely just an issue of prioritization. It would help us prioritize if you can tell us your use case / which websites will be impacted by this feature.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195173</commentid>
    <comment_count>6</comment_count>
    <who name="Apolo">apolostudioapps</who>
    <bug_when>2026-03-30 08:52:46 -0700</bug_when>
    <thetext>I was working on redoing the IME strategy (and overall textfields inner workings) for https://github.com/JetBrains/compose-multiplatform for Web projects since right now it is using a backing textarea with a lot of extra, difficult to reason and hard to maintain code to make it work as if it was a native textfield (it as a Canvas-based framework). It would allow to have a unified api without weird workarounds for each platform. It would also help &quot;force&quot; Firefox to accelerate their implementation since they too have a positive position but have not prioritised it yet. 
Related code: 
https://github.com/JetBrains/compose-multiplatform-core/blob/jb-main/compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/platform/BackingDomInput.kt
https://github.com/JetBrains/compose-multiplatform-core/blob/jb-main/compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/platform/DomInputStrategy.
https://github.com/JetBrains/compose-multiplatform-core/blob/jb-main/compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/platform/NativeInputEventsProcessor.kt
https://github.com/JetBrains/compose-multiplatform-core/blob/jb-main/compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/platform/WebTextInputService.kt
https://github.com/JetBrains/compose-multiplatform-core/blob/jb-main/compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/window/WebTextInputSession.kt</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195476</commentid>
    <comment_count>7</comment_count>
    <who name="">dcordoneanu</who>
    <bug_when>2026-03-31 02:07:39 -0700</bug_when>
    <thetext>Hello,

I&apos;m part of the Adobe team. Two of the products (already launched) with millions of monthly users:

- Adobe Express: https://express.adobe.com/
- Firefly boards: https://firefly.adobe.com/boards

We&apos;re drawing text on a canvas and EditContext would offer the users a native experience (especially for scenarios related to IME and CJK). We&apos;re already using it successfully on Chromium-based browsers.

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2198293</commentid>
    <comment_count>8</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2026-04-09 01:06:28 -0700</bug_when>
    <thetext>Thanks for giving us examples. This will help us prioritize the feature :)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>