w3c / input-events

Input Events
https://w3c.github.io/input-events/
Other
23 stars 16 forks source link

InputEvent fired twice when inserted emoji #136

Open erman999 opened 2 years ago

erman999 commented 2 years ago

When standard characters inserted there is no problem it behaves as it should be. However, while inserting emojis event fires twice. I realised that inserted data length returns 2 when inserted emoji.

Untitled

To open emoji menu on Windows 11 use Win + .

luisspassos commented 1 year ago

I prevented the function from running twice with a boolean

let continueInputEvent = true;

function handleInput() {
  if(!continueInputEvent) return;

  // code

  continueInputEvent = false;

  setTimeout(() => {
    continueInputEvent = true;
  }, 0)
}
johanneswilm commented 1 year ago

@erman999 Does this happen in every browser? That sounds like a browser error to me.

luisspassos commented 1 year ago

I think that its an issue from Input Method Editor of OS, like Windows

johanneswilm commented 1 year ago

@erman999 @luisspassos So this is happening in both Firefox and Chrome on Windows? And it does not happen if you use another IME to input those emojis? If it is an issue that is internal to one particular IME, then it's not something we can do anything about. Hopefully someone at the company selling that IME is responsible and can be contacted.

Or do you think there is some wording in our document that is unclear which caused browser developers to implement it in a way that doesn't make sense? In that case we should change the wording and then contact the developers to fix their implementation.

luisspassos commented 1 year ago

@johanneswilm It looks like it's a problem with chrome based browsers. In chrome and edge, the emojis double. In Firefox, it's only once.