Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

87
Views
Issues Dispatching CompositionEvents

I am creating a WYSIWYG editor and am trying to dispatch a pair of CompositionEvents (compositionstart and compositionupdate). The editor utilizes a private document model, and each key event is processed and recorded in said document model. After the key recording, if needed (depending on cross element selections, and the start/end elements selected), I may need to redraw an element, or a portion of an element.

The thinking is to capture the user's CompositionEvents, process the changes to the document model and elements, and then dispatch a copy of the user's CompositionEvents. Here is the code I have written (currently the events are hard-coded; I'm just testing a proof of concept):

var compStart = new CompositionEvent('compositionstart', {
  bubbles:true,
  cancelBubble:false,
  cancelable:true,
  composed:true,
  data:"",
  returnValue:true,
  view:window,
});
var compUpdate = new CompositionEvent('compositionupdate', {
  bubbles:true,
  cancelBubble:false,
  cancelable:true,
  composed:true,
  data:"´",
  returnValue:true,
  view:window,
});
document.querySelector('client-control-wysiwyg').dispatchEvent(compStart);
document.querySelector('client-control-wysiwyg').dispatchEvent(compUpdate);

The event listeners fire when these event are dispatched, but the character "´" never appears in the element.

These two events are identical to those that are created when I type the keyboard combo Option + E on my Mac, with the exception of isTrusted, which is expected as these are being manually triggered.

Is it possible to dispatch CompositionEvents?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!