iOS compositionend waiting

Sorry for the very vague report.

I’m native Japanese and I’m using codemirror for Japanese input.
I’m using codemirror on iOS safari(version 15), and sometimes the line feed input with Enter doesn’t work, which makes me feel very uncomfortable.

Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1

Specifically, if I try to continue a newline after composing end, the input will be ignored. If I don’t consciously execute the line break at the delayed timing, the line break will not be accepted as expected.

The following code seems to be relevant.

if (browser.safari && Date.now() - this.compositionEndedAt < 500) {
  this.compositionEndedAt = 0;
  return true;
}

As a test, when I changed this 500ms to 100ms, the discomfort was alleviated.

if (browser.safari && Date.now() - this.compositionEndedAt < 100) {
  this.compositionEndedAt = 0;
  return true;
}

I’ve been using it for a few days and haven’t had any issues.
500ms felt like waiting for a fairly large amount of time.

I think it is difficult to make adjustments, but I thought that some people might have the same problems, so I made a report.

Yeah, that seems reasonable. The order of the compositionend/keydown events is unpredictable on Safari-based browsers here, but I guess they will occur within 100ms of each other. This patch makes the change.