The compositionstart event fires when an IME (Input Method Editor) or other text composition system starts a new composition session. Learn addEventListener vs oncompositionstart, CompositionEvent.data, how it pairs with compositionupdate / compositionend, and five try-it labs.
01
Kind
Instance event
02
Type
CompositionEvent
03
When
IME session starts
04
Handler
oncompositionstart
05
Key field
event.data
06
Status
Baseline widely available
Fundamentals
Introduction
Languages such as Chinese, Japanese, and Korean often use an IME. The user types phonetic or stroke hints; the system shows candidates; then a final character (or string) is committed into the field.
That whole flow is a composition session. compositionstart means the session just began—before candidates settle and before the final character is committed. MDN’s classic example is starting a Chinese character with a Pinyin IME.
💡
Beginner tip
On compositionstart, mark your UI as composing (pause live search, show a hint). Wait for compositionend before treating text as final.
Concept
Understanding compositionstart
An instance event that answers: “Did an IME composition session just begin?”
Fires when a new composition session starts.
CompositionEvent — read data (and sometimes locale).
Siblings — compositionupdate, compositionend.
Useful for pausing search, showing “composing…” UI, custom editors.
Baseline Widely available on MDN (since July 2015).
Foundation
📝 Syntax
Use the event name with addEventListener, or set the handler property:
A CompositionEvent (inherits from UIEvent and Event).
Event properties
Property
Meaning
data
Characters generated by the input method for this event
locale
Locale of the current input method (when available)
Sequence
🔁 Composition Session Flow
compositionstart — the IME session begins.
compositionupdate — candidate / composing text changes (may fire many times).
compositionend — session completes or is canceled; check event.data.
Ordinary Latin typing may never fire these events. They matter most when an IME is active.
Compare
⚖️ Composition vs input / beforeinput
API
Role during IME
composition*
Session lifecycle (start / update / end)
beforeinput
Edit about to apply; isComposing may be true
input
Value changed; may fire during and after composition
Cheat Sheet
⚡ Quick Reference
Goal
Code / note
Listen
el.addEventListener("compositionstart", fn)
Handler property
el.oncompositionstart = fn
Committed text
event.data
Log full IME flow
Also listen to start + update
MDN status
Baseline Widely available (Jul 2015)
Snapshot
🔍 At a Glance
Four facts to remember about compositionstart.
Event type
CompositionEvent
data + locale
Means
IME start
Session begins
Pair with
start/update
Full session
Baseline
yes
Widely available
Hands-On
Examples Gallery
Examples follow MDN Element: compositionstart event. To see live IME events, enable an IME (for example macOS Option+`, Windows Win+., or a CJK keyboard).
📚 Getting Started
Log when an IME composition session begins (MDN style).
compositionstart is marked Baseline Widely available on MDN (since July 2015). Logos use the shared browser-image-sprite.png sprite from this project. Exact IME UI and shortcuts still depend on the operating system and language pack.
✓ Baseline · Widely available
Element compositionstart
Works across modern desktop and mobile browsers when an IME composition session begins.
100%Widely available
Google ChromeSupported · Desktop & Android
Full support
Mozilla FirefoxSupported · Desktop & Android
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
OperaSupported · Modern versions
Full support
Internet ExplorerSupported (legacy)
Supported
compositionstartBaseline
Bottom line: Listen for compositionstart to mark composing UI; pair with update/end for the full IME session.
Wrap Up
Conclusion
compositionstart is the “IME session began” signal. Set composing state, pause live logic that needs final text, then wait for compositionend to resume.
Assume composition events fire for plain Latin typing
Treat text as final as soon as composition starts
Forget to clear composing flags when the session ends
Confuse composition with the everyday input event
Overwrite oncompositionstart if you need multiple listeners
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about compositionstart
IME session began—mark composing, then wait for end.
5
Core concepts
🌐01
IME started
new session
Event
📄02
CompositionEvent
data + locale
API
🔁03
Before update
start of session
Order
🔎04
Pause mid-IME
search later
Pattern
🎯05
Baseline
widely available
Compat
❓ Frequently Asked Questions
It fires when a text composition system such as an Input Method Editor (IME) starts a new composition session — for example when a user begins entering a Chinese character with a Pinyin IME.
No. MDN marks Element compositionstart as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
A CompositionEvent (inherits from UIEvent). Useful properties include data (characters generated for this event) and locale (input method locale).
compositionstart begins a session, compositionupdate fires as the candidate text changes, and compositionend fires when the session completes or is canceled.
On macOS you can often use Option + ` to open an IME panel; on Windows, Win + . opens emoji/IME-related UI. Exact shortcuts depend on OS language settings. You can also switch to a CJK keyboard layout.
Mark your UI as composing: pause live search, avoid treating partial IME text as final, and wait for compositionend (or input with isComposing false) before committing logic.
Did you know?
MDN’s demo tips for opening IME UI: on macOS try Option+`; on Windows try Win+.. Your OS language settings still control which IMEs are installed.