This reposition code will not be sufficient as the caret will be updated at times other than when the cursor moves. It also will not update until next tick after a bunch of ops. Perhaps it's worth exposing a caret signal that can be emitted when the caret updates it's own size and position? There would be nothing stopping you from separating out the IME composition logic which should stay here, the event trap placement logic into a different place that can be shared with the event trap. One such place this could occur is in CaretManager, as the manager knows when the local caret is being added. It could potentially "tie" the event trap and caret together (e.g., caret.addOverlayElement(eventTrap)). This would keep the InputMethodEditor class purely "functional", and allow the caret to concern itself with the UI aspect of eventTrap placement.