-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make "Input Events Level 1" declare "beforeinput cancelable" of "insertCompositionText" as "Undefined" #115
Comments
Hey @masayuki-nakano , If the advice we received on that is incorrect and we need to add it to the level 1 spec as well, I think we need to add @frivoal @marcoscaceres - any comment? |
@masayuki-nakano The changes the Chrome team did to level 1 was to make it possible to make all the text insertion events not be cancelable (only formatting changes are cancelable). The idea behind this was, AFAIAA, that given that it was not possible to have composition be cancelable on Chrome on Android, one wanted to make all the text insertion not be cancelable, so that JS editor projects would be forced to write code to undo the last change and then redo it, rather than write editors that only work on desktop computers in Latin script languages. What you seem to describe is something similar to level 2 - which is what we actually wanted but couldn't do due to this bug on Android. Given that they made all text insertion on-cancelable in Chrome, also from keyboards, I would be surprised if they would now want to make it cancelable anyway. And if you implement it differently in Firefox rather than use either level 1 or 2, then we are back at square one where JS editor devs need to write browser specific code. |
Is there a PR by someone from Mozila on adding this to Input Events, Level 1 somewhere and could we get someone to present the proposal to add this to the spec before it is being moved to CR either at TPAC or one of the Editing Taskforce monthly meetings some time soon? |
No, on Chrome, I can cancel
Well, I didn't think about Android's IME limitation. However, I'm suggesting about the case only when the composition ends. I.e., in most cases, it won't hit any IME limitation of any platforms, I guess.
Yes, therefore, I'd like to here second opinions of other vendors. |
Aha. In that case it seems like Chromium has moved it's implementation closer to level 2. In all of the cases where the Blink implementation matches that of Webkit/level 2, I think we should adjust level 1 to be the same as level 2. The only point with level 1 was that Blink could not implement all of level 2 for technical/internal reasons and so if those reasons are gone, we should make the delta between the two as small as possible by adjusting level 1. @gked Any idea on who working on this in the Blink codebase who could verify that Chromium has now implemented level 2 for the various input types and that they are cancelable on all platforms?
If I remember correctly, the issue was with partially committed IME strings - what happens if there is a long string in the IME and only part of that is committed to the DOM. If you can make it work like Webkit/level 2 by using |
React developer said that they also want to handle committing composition with I believe that this is important issue and Blink should change the behavior for making web apps possible to handle composition easier. (Then, Firefox will ship |
Ah, if |
Ping @alexkeng and @snianu. See also w3c/editing#275 . Could we get an answer to whether we can make level 1 get most of what is specified in level 2 thus far? |
@bokand @mustaqahmed @NavidZ Adding few folks from Chrome team who would know more about these changes. |
Just to follow-up on this issue. @gked found the change in Chromium that made the beforeInput events cancellable. Here is the thread about this issue: w3c/editing#275. @masayuki-nakano @johanneswilm Re |
@snianu In the table it says about Maybe some of the wording should be clarified? But I think Safari is doing the right thing if it does what you describe. The whole point of first removing it (with |
That is because FF, Chrome & Edge have only implemented level 1 of the spec (and apparently recently Chrome/Edge recently also parts of level 2, except those parts that relate to IME - the |
Oh, Firefox implemented Leve2 only for the Of course, I could change the behavior as Safari does. However, it causes |
And I feel odd for current definition of
This means that only while dispatching |
Ah, Safari fires |
And neither |
@masayuki-nakano If you fire the
Because this way the JavaScript editor can contain the DOM changes caused by IME and has the chance to influence them. For example, in a given editor, the JavaScript may not allow certain changes, or put each word or each letter inside a dom node. We have been discussing this for many years in the Editing Taskforce and tried to find other options, but the approach that we wrote in level 2, that Safari has implemented, is the only viable way we have found. Yes, there is one dom update that is not always needed, but that is very little in comparison to the amount of dom updates that are occurring inside a JavaScript-based editor, and there is a natural speed limit anyway in that the user cannot type endlessly fast. |
The |
We should hear with Safari why this is happening and if there are reasons for why they did not implement this part.
The latest from the Editing Taskforce is that we have decided to investigate whether we can merge level 1 and level 2. This may be in the form of us dropping level 1, and marking the |
No worry, we'd like to ship
If so, why WebKit still behaves differently even from the Level 2 draft? I bet nobody has checked deeply around composition.
Unfortunately, there is no way to test composition with TestDriver for WPT, but even excepting the reason, there is too few tests for
For the simple design, I understand that And this issue is same as #86 . Newly dispatching |
It's a combination of several things. One is that the dom diffing libraries have become quite good. Another is that some of the worst contenteditable glitches have been taken care of. A third is that still not all browsers have implemented the beforeinput event (notably Firefox), which means it is not an approach that works universally anyway. And then probably the extra input event just didn't bother anyone enough. But I agree that we need to get this in order going forward. Once all browsers have this by default, we should expect more users as well.
The idea is that there is an before/input event for each editor dom change and that the DOM doesn't just change without there being such an event. Someone might just listen to all the before/inputevents and take a snapshot of the DOM at each stage and then keep a history as to how things changed.
I have found bugs in both Chrome and Webkit in the past on input events. I'm not assuming they are bugfree as of today. I have tried to write tests for everything I could test using the testdriver. As you say, it is somewhat restricted. I would very much welcome more tests as long as they are really testing the things that are in level 1 or 2 of the spec. Help/collaboration would be greatly appreciated.
I understand the concern and I agree that it would possibly have been better to choose another event name for this, but given the amount of bugs editors have had to deal with over the years, which have been constantly shifting and changing, I don't really think that is a great concern. Any JS editor needs to be able that any of the browsers change their behavior from version to version without any announcements for the past decade or so. We did not get a great uproar of users complaining about Safari introducing this input event either. |
@johanneswilm: Sorry for the delay to reply.
I don't think so. In my experience, web developers usually add workaround without filing issues to web browsers not spec. And this is also same as browser users. Actually, we've got a web-compat issue report which is caused by a bug of Blink that is not dispatching
Thanks. My point here is, when porting a part of Level 2 to Level 1, any things which may change current behavior should be ported to Level 1 because if it's fine, both Mozilla and Google implement Level 2 as-is. Supporting Level 1 is caused some breaking the web risk.
Well, then, it becomes off topic though, deleted text by composition should be restored temporarily? Safari does not behave so. Anyway, my main proposal here is,
|
I think we should fix Chromium's behavior so all browsers have a standard behavior. I'll see if I can fix that in Chromium, but this should be a bug on Chrome and shouldn't be considered a standard behavior as that also impacts other composition events like you mentioned. From what I understand, @johanneswilm (please correct me if I'm wrong here) point is that web devs need events before and after DOM mutation during composition in order to make deterministic decisions about DOM changes. If we don't fire But there is also concern about Re: Also not related to |
The |
Yes, of course, the Chromium's bug should be fixed. But I tried to say that different
Right. But if it's followed by another
In Gecko, a composition creates a manager object internally, and stores the event target for the following composition events until I think that UI Events should define event target of composition events as so.
I think that its
Yeah, Safari's behavior is wired and invalid (without reasonable reasons). So, anyway, their contributors need to rewrite around it.
FYI: From point of view of native apps like browsers, it cannot distinguish that whether the new composition is for recomposition for selected text or new composition replacing selected text.
I understand the usage for the |
The
This is true and I agree that it would be hard for us to differentiate those two cases. |
When we recompose a text, Safari fires |
@snianu @saschanaz @masayuki-nakano The level 1 of Input Events that is mentioned in this issue has since been discontinued. Should we close this issue or is there anything in here that is still relevant for level 2 and beyond also? |
Yeah, sounds reasonable. If there is an issue whether cancelable or not of |
Level 1 spec declares
"insertCompositionText"
is not cancelable.https://rawgit.com/w3c/input-events/v1/index.html#interface-InputEvent-Attributes
However, Level 1 does not have cancelable
"insertFromComposition"
. And Chrome supports Level 1, and Firefox will follow it soon. This means that web apps cannot cancel inserting text only from composition so that I'd like to suggest that only when IME commits composition, Level 1 browsers should makebeforeinput
whoseinputType
is"insertCompositionText"
cancelable. For doing this, it should be defined as "Undefined".(Or, adding
"insertFromComposition"
into Level 1 might be more reasonable.)The text was updated successfully, but these errors were encountered: