Phenomenon
When composing Chinese text with Pinyin IME in a contenteditable element, pressing Tab cancels the composition and causes focus to navigate to the next element. The composed text may be lost or partially committed before navigation occurs.
Reproduction example
- Focus the editable area (e.g., in a form or table).
- Activate Chinese Pinyin IME.
- Type Pinyin text (e.g., “nihao”) and start character conversion.
- Press Tab to navigate to the next element.
Observed behavior
- The compositionend event fires with incomplete data
- Focus moves to the next element
- Composed text may be lost or partially committed
- The Tab key behavior conflicts with composition handling
Expected behavior
- Composition should complete before Tab navigation occurs
- Composed text should not be lost
- Tab navigation should work consistently with or without active composition
Browser Comparison
- Firefox: Tab may cancel composition and navigate focus
- Chrome: May have different Tab key behavior during composition
- Edge: Similar to Chrome
- Safari: Not applicable on Windows
Notes and possible direction for workarounds
- Prevent Tab during active composition
- Wait for composition to complete before allowing Tab navigation
- Handle Tab key events carefully during composition